Port linux2.6.18 to ARM9.

Source: Internet
Author: User
If you don't talk nonsense, let's talk about how to change it,
(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 (maid + 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 = {
& Initi_device_usb,
& Amp; cloud_device_ LCD,
& Amp; cloud_device_wdt,
& Amp; initi_device_i2c,
& Amp; cloud_device_iis,
& Cs89x0_device,
};
(3) add support for CS8900 Nic
See 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 22:10:15. 000000000 + 0800
@-96,6 + 96,9 @@
Dmitrypervushin: 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 };
+ # 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 };
+ /*
+ # 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 Weibo
+ _ 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 Weibo
+ Static 2010
+ Readword (unsigned long base_addr, int portno)
+ {
+ Return _ raw_readw (base_addr + portno );
+}
+
+ Static void
+ Writeword (unsigned long base_addr, int portno, 2010value)
+ {
+ _ Raw_writew (value, base_addr + portno );
+}
# Else
Static 2010
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 );
@-, 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 21:50:40. 000000000 + 0800
@-Random + random @@
 
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
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
Network (Ethernet) card of this type, say y and read
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 09:33:58. 000000000 + 0800
++ Linux-2.6.18.2_nano2410/include/ASM-arm/arch-s3c2410/map. h 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 16 m 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 09:33:58. 000000000 + 0800
++ Linux-2.6.18.2_nano2410/include/ASM-arm/IRQ. h 18:25:38. 000000000 + 0800
@-, 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) There are also added support for devfs. I will not say much about this because there are a lot of online materials.
(5) We recommend that you use the 3.4.1 compiler for compiling.
(6) There is a lot of information on the Internet to say that MTD should be removed from the ECC test on NAND, but after my tests, there will be many problems in doing so. In particular, when using the yaffs file system, you should turn off the ECC that comes with yaffs and use the mtd ecc.
(7) porting yaffs will be discussed later.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.