fl2440內核移植(四)——DM9000移植

--------------------------------------------------------------------------------------------------------------------------------

   系統環境:Centos 6.5

   板子芯片:s3c2440

   內核版本:linux 3.0

      編譯器:arm-linux-gcc 4.5.4

          作者:Lu Zengmeng <[email protected]>

--------------------------------------------------------------------------------------------------------------------------------


1、修改arch/arm/mach-s3c2440/mach-smdk2440.c

#include<linux/dm9000.h>  //添加dm9000頭文件

在設備結構體中添加dm9000網卡

static struct platform_device *smdk2440_devices[] __initdata = {
     &s3c_device_ohci,
     &s3c_device_lcd,
     &s3c_device_wdt,
     &s3c_device_i2c0,
     &s3c_device_iis,
     &s3c_device_rtc,
     &s3c_device_dm9000,
};

添加如下代碼:

/*DM9k ethernet driver info,add by Lu Zengmeng,2015-11-25*/
#define DM9000_BASE    (S3C2410_CS4 + 0x300)
static struct resource s3c_dm9000_resource[] = {
             [0] = {
                                 .start = DM9000_BASE,
                                  .end   = DM9000_BASE + 3,
                                  .flags = IORESOURCE_MEM
             },
             [1] = {
                                  .start = DM9000_BASE + 4,
                                  .end   = DM9000_BASE + 7,
                                  .flags = IORESOURCE_MEM
             },
             [2] = {
                                 .start = IRQ_EINT7,
                                 .end   = IRQ_EINT7,
                                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
             }
};


/*  The DM9000 has no eeprom, and it's MAC address is set by
    the bootloader before starting the kernel.*/


static struct dm9000_plat_data s3c_dm9000_pdata = {
            .flags      = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
};


static struct platform_device s3c_device_dm9000 = {
            .name       = "dm9000",
            .id     = -1,
            .num_resources  = ARRAY_SIZE(s3c_dm9000_resource),
            .resource   = s3c_dm9000_resource,
            .dev        = {
                                                .platform_data  = &s3c_dm9000_pdata,
                                },
};
/*End of DM9K*/

2、配置menuconfig,使能DM9000相關驅動

                        Device Drivers--->

                         [*]Network device support--->

                                 --- Network device support   ---                                                                                
  │ │                                      < >   Dummy net driver support                                                                              
  │ │                                      < >   Bonding driver support                                                                                
  │ │                                      < >   MAC-VLAN support (EXPERIMENTAL)                                                                        
  │ │                                      < >   EQL (serial line load balancing) support                                                          
  │ │                                      <M>   Universal TUN/TAP device driver support                                                              
  │ │                                      < >   Virtual ethernet pair device                                                                          
  │ │                                      -*-   Generic Media Independent Interface device support                                                    
  │ │                                      < >   PHY Device support and infrastructure  --->                                                          
  │ │                                      [*]   Ethernet (10 or 100Mbit)  ---> 

 --- Ethernet (10 or 100Mbit)                                                                              
  │ │                                      < >   ASIX AX88796 NE2000 clone support                                                                    
  │ │                                      < >   SMC 91C9x/91C1xxx support                                                                            
  │ │                                      <*>   DM9000 support                                                                                      
  │ │                                      (4)     DM9000 maximum debug level                                                                        
  │ │                                      [ ]     Force simple NSR based PHY polling

重新編譯內核後燒錄到開發板上測試

>: ifconfig 
eth0      Link encap:Ethernet  HWaddr 08:00:3E:26:0A:51  
          inet addr:192.168.11.51  Bcast:192.168.11.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:32 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2238 (2.1 KiB)  TX bytes:0 (0.0 B)
          Interrupt:51 Base address:0x2300 

移植完成

發佈了29 篇原創文章 · 獲贊 11 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章