移植linux2.6.18到arm9

废话不说了,就讲讲要怎么改,
(1)arch/arm/mach-s3c2410/common-smdk.c

static struct s3c2410_platform_nand smdk_nand_info = {

  .tacls        = 0,
 .twrph0        = 30,
  .twrph1        = 0,
     .nr_sets    = ARRAY_SIZE(smdk_nand_sets),
     .sets        = smdk_nand_sets,
 };
(2)arch/arm/mach-s3c2410/mach-smdk2410.c
 static struct map_desc smdk2410_iodesc[] __initdata = {
   /* nothing here yet */
/* Map the ethernet controller CS8900A */
{ 0xe0000000, __phys_to_pfn(S3C2410_CS3+0x01000000), SZ_1M, MT_DEVICE }
 };
static struct resource cs89x0_resources[] = {drivers/net/cs89x0.c
    [0] = {
        .start    = 0x19000000,
        .end    = 0x19000000 + 16,
        .flags    = IORESOURCE_MEM,
    },
    [1] = {
        .start    = IRQ_EINT9,
        .end    = IRQ_EINT9,
        .flags    = IORESOURCE_IRQ,
    },
};
 
static struct platform_device cs89x0_device = {
    .name        = "cirrus-cs89x0",
    .num_resources    = ARRAY_SIZE(cs89x0_resources),
    .resource    = cs89x0_resources,
};
 static struct platform_device *smdk2410_devices[] __initdata = {
     &s3c_device_usb,
     &s3c_device_lcd,
     &s3c_device_wdt,
     &s3c_device_i2c,
     &s3c_device_iis,
    &cs89x0_device,
 };
(3)添加对cs8900网卡的支持
 主要看patch
diff -Nur linux-2.6.18.2/drivers/net/cs89x0.c linux-2.6.18.2_nano2410/drivers/net/cs89x0.c
--- linux-2.6.18.2/drivers/net/cs89x0.c    2006-11-04 09:33:58.000000000 +0800
+++ linux-2.6.18.2_nano2410/drivers/net/cs89x0.c    2007-06-29 22:10:15.000000000 +0800
@@ -96,6 +96,9 @@
   Dmitry Pervushin  : dpervushin@ru.mvista.com
                     : PNX010X platform support
 
+  Christian Pell    : chripell@gmail.com
+                    : SMDK2410 platform support, fixed bug with signed ioaddr
+
 */
 
 /* Always include 'config.h' first in case the user wants to turn on
@@ -194,6 +197,26 @@
 #define CIRRUS_DEFAULT_IRQ    VH_INTC_INT_NUM_CASCADED_INTERRUPT_1 /* Event inputs bank 1 - ID 35/bit 3 */
 static unsigned int netcard_portlist[] __initdata = {CIRRUS_DEFAULT_BASE, 0};
 static unsigned int cs8900_irq_map[] = {CIRRUS_DEFAULT_IRQ, 0, 0, 0};
+#elif defined(CONFIG_ARCH_S3C2410)
+#include <linux/irq.h>
+#include <asm/irq.h>
+#include <asm/arch/irqs.h>
+#include <asm/arch/regs-mem.h>
+#include <asm/arch/regs-gpio.h>
+#include <asm/arch/map.h>
+
+static unsigned int netcard_portlist[] __initdata = {0xe0000300, 0};
+static unsigned int cs8900_irq_map[] = {IRQ_EINT9, 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[] __initdata =
    { 0x300, 0x320, 0x340, 0x360, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, 0};
@@ -246,7 +269,7 @@
 
 /* Index to functions, as function prototypes. */
 
-static int cs89x0_probe1(struct net_device *dev, int ioaddr, int modular);
+static int cs89x0_probe1(struct net_device *dev, unsigned int ioaddr, int modular);
 static int net_open(struct net_device *dev);
 static int net_send_packet(struct sk_buff *skb, struct net_device *dev);
 static irqreturn_t net_interrupt(int irq, void *dev_id, struct pt_regs *regs);
@@ -323,7 +346,10 @@
     netdev_boot_setup_check(dev);
     io = dev->base_addr;
     irq = dev->irq;
-
+    #ifdef CONFIG_ARCH_S3C2410 //Added weibing
+    __raw_writel((__raw_readl(S3C2410_GPGCON)&~(0x3<<2))|(0x2<<2),S3C2410_GPGCON);
+     __raw_writel((__raw_readl(S3C2410_EXTINT1)&~(0x7<<4))|(0x4<<4),S3C2410_EXTINT1);
+    #endif
     if (net_debug)
         printk("cs89x0:cs89x0_probe(0x%x)\n", io);
 
@@ -386,6 +412,18 @@
 {
     outw(value, base_addr + (portno << 1));
 }
+#elif defined(CONFIG_ARCH_S3C2410) //Added weibing
+static u16
+readword(unsigned long base_addr, int portno)
+{
+ return __raw_readw(base_addr+portno);
+}
+
+static void
+writeword(unsigned long base_addr, int portno,u16 value)
+{
+ __raw_writew(value,base_addr+portno);
+}
 #else
 static u16
 readword(unsigned long base_addr, int portno)drivers/net/cs89x0.c
@@ -507,7 +545,7 @@
  */
 
 static int __init
-cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
+cs89x0_probe1(struct net_device *dev, unsigned int ioaddr, int modular)
 {
     struct net_local *lp = netdev_priv(dev);
     static unsigned version_printed;
@@ -638,7 +676,18 @@
        the driver will always do *something* instead of complain that
        adapter_cnf is 0. */
 
-#ifdef CONFIG_SH_HICOSH4
+#if defined CONFIG_ARCH_S3C2410
+lp->force=FORCE_RJ45;
+lp->auto_neg_cnf=IMM_BIT;
+
+ dev->dev_addr[0]=0x08; /*setMACaddress*/
+ dev->dev_addr[1]=0x00;
+ dev->dev_addr[2]=0x3E;
+ dev->dev_addr[3]=0x26;
+ dev->dev_addr[4]=0x0A;
+ dev->dev_addr[5]=0x5B;
+
+#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
@@ -828,7 +877,13 @@
     }
 
     printk(" IRQ %d", dev->irq);
-
+    dev->dev_addr[0] = 0x00;
+    dev->dev_addr[1] = 0x00;
+    dev->dev_addr[2] = 0xc0;
+    dev->dev_addr[3] = 0xff;
+    dev->dev_addr[4] = 0xee;
+    dev->dev_addr[5] = 0x08;
+    set_mac_address(dev, dev->dev_addr);
 #if ALLOW_DMA
     if (lp->use_dma) {
         get_dma_channel(dev);
@@ -1036,7 +1091,7 @@
 {
 #if !defined(CONFIG_MACH_IXDP2351) && !defined(CONFIG_ARCH_IXDP2X01)
     struct net_local *lp = netdev_priv(dev);
-    int ioaddr = dev->base_addr;
+    unsigned int ioaddr = dev->base_addr;
 #endif
     int reset_start_time;
 
@@ -1278,7 +1333,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 < 2) {
         /* Allow interrupts to be generated by the chip */
 /* Cirrus' release had this: */
@@ -1309,7 +1364,7 @@
     else
 #endif
     {
-#if !defined(CONFIG_MACH_IXDP2351) && !defined(CONFIG_ARCH_IXDP2X01) && !defined(CONFIG_ARCH_PNX010X)
+#if !defined(CONFIG_MACH_IXDP2351) && !defined(CONFIG_ARCH_IXDP2X01) && !defined(CONFIG_ARCH_PNX010X)&& !defined(CONFIG_ARCH_S3C2410)
         if (((1 << dev->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);
@@ -1324,6 +1379,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, IRQT_RISING);
+#endif
         ret = request_irq(dev->irq, &net_interrupt, 0, dev->name, dev);
         if (ret) {
             if (net_debug)
@@ -1394,7 +1452,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) {
@@ -1577,7 +1635,8 @@
 {
     struct net_device *dev = dev_id;
     struct net_local *lp;
-    int ioaddr, status;
+    unsigned int ioaddr;
+    int status;
      int handled = 0;
 
     ioaddr = dev->base_addr;
@@ -1682,8 +1741,8 @@
     struct net_local *lp = netdev_priv(dev);
     struct sk_buff *skb;
     int status, length;
-
-    int ioaddr = dev->base_addr;
+   
+    unsigned int ioaddr = dev->base_addr;
     status = readword(ioaddr, RX_FRAME_PORT);
     length = readword(ioaddr, RX_FRAME_PORT);
 
diff -Nur linux-2.6.18.2/drivers/net/Kconfig linux-2.6.18.2_nano2410/drivers/net/Kconfig
--- linux-2.6.18.2/drivers/net/Kconfig    2006-11-04 09:33:58.000000000 +0800
+++ linux-2.6.18.2_nano2410/drivers/net/Kconfig    2007-06-29 21:50:40.000000000 +0800
@@ -1274,7 +1274,7 @@
 
 config NET_PCI
     bool "EISA, VLB, PCI and on board controllers"
-    depends on NET_ETHERNET && (ISA || EISA || PCI)
+    depends on NET_ETHERNET && (ISA || EISA || PCI || ARCH_S3C2410)
     help
       This is another class of network cards which attach directly to the
       bus. If you have one of those, say Y and read the Ethernet-HOWTO,
@@ -1414,7 +1414,7 @@
 
 config CS89x0
     tristate "CS89x0 support"
-    depends on NET_PCI && (ISA || MACH_IXDP2351 || ARCH_IXDP2X01 || ARCH_PNX010X)
+    depends on NET_PCI && (ISA || MACH_IXDP2351 || ARCH_IXDP2X01 || ARCH_PNX010X || ARCH_S3C2410)
     ---help---
       Support for CS89x0 chipset based Ethernet cards. If you have a
       network (Ethernet) card of this type, say Y and read the
diff -Nur linux-2.6.18.2/include/asm-arm/arch-s3c2410/map.h linux-2.6.18.2_nano2410/include/asm-arm/arch-s3c2410/map.h
--- linux-2.6.18.2/include/asm-arm/arch-s3c2410/map.h    2006-11-04 09:33:58.000000000 +0800
+++ linux-2.6.18.2_nano2410/include/asm-arm/arch-s3c2410/map.h    2007-06-29 22:11:49.000000000 +0800
@@ -160,6 +160,11 @@
 #define S3C2440_PA_CAMIF   (0x4F000000)
 #define S3C2440_SZ_CAMIF   SZ_1M
 
+ /* CS8900 */
+#define S3C24XX_VA_cs8900   S3C2410_ADDR(0xe0000000)
+#define S3C2410_PA_CS8900     __phys_to_pfn(0x19000000)
+#define S3C24XX_SZ_cs8900    SZ_1M
+#define S3C24XX_PA_cs8900    S3C2410_PA_CS8900
 /* ISA style IO, for each machine to sort out mappings for, if it
  * implements it. We reserve two 16M regions for ISA.
  */
diff -Nur linux-2.6.18.2/include/asm-arm/irq.h linux-2.6.18.2_nano2410/include/asm-arm/irq.h
--- linux-2.6.18.2/include/asm-arm/irq.h    2006-11-04 09:33:58.000000000 +0800
+++ linux-2.6.18.2_nano2410/include/asm-arm/irq.h    2007-06-29 18:25:38.000000000 +0800
@@ -36,7 +36,7 @@
 #define IRQT_LOW    (__IRQT_LOWLVL)
 #define IRQT_HIGH    (__IRQT_HIGHLVL)
 #define IRQT_PROBE    IRQ_TYPE_PROBE
-
+int set_irq_type(unsigned int irq, unsigned int type);
 extern void migrate_irqs(void);
 #endif
(4)还有添加对devfs的支持,网上资料一大堆,我就不多说了。
(5) 推荐用3.4.1版本的编译器编译。
(6)网上有很多资料多说要去掉mtd对nand的ecc检测,但是经过我的测试,这样做会有很多问题。特别是使用yaffs文件系统,就应该关掉yaffs自带的ecc,而用mtd的ecc。
(7)yaffs的移植,我后面再说。
posted @ 2007-07-01 22:16  swordzj  阅读(399)  评论(0编辑  收藏  举报