U-boot-2014.10 port 18th days ---- add DM9000 Nic support (2), holiday schedule

Source: Internet
Author: User
Tags network function ping network

U-boot-2014.10 port 18th days ---- add DM9000 Nic support (2), holiday schedule
Modify code

Accidentally deleted this blog, and the recycle bin did not save the draft. Now I can write it again!

DM9000 itself also has a base address. This base address is bound by the TXD [] (strap pins) pin. The formula is met:

IO base = (pin value of TXD []) * 10 H + 300 H

TXD [] pins are in 8 state, so I/O base addresses have eight base addresses: 300 H, 310 H, 320 H, 340 H, 350 H, 370 H, H, and H.

After all, multiple DM9000 NICs are used in some applications. Therefore, you need to select the NIC to be operated based on the base address of each Nic ~ 9 is the address bus used to select DM9000. When the SA9 and SA8 pins are high, SA7 and AEN are low, SA6 ~ 4-pin status and TXD2 ~ When the 0 (strap pins) PIN status matches, the DM9000 NIC will be selected.

The above DM9000 circuit diagram of the TQ2440 schematic diagram shows TXD2 ~ The 0 pin is suspended. What is the status of the pin? SA7 ~ 4-pin is directly, that is, low-level, so it is estimated that the suspended TXD2 ~ The 0-pin status is low. Otherwise, the dm9000 NIC will not be selected. SA9 ~ 8 is connected to the 3.3V voltage, so it is a high level. Therefore, It is inferred that the base address of DM9000 is 300 H.

Considering that DM9000 is mapped to BANK4 by 2440, the space is 0x2000 0000 ~ 0x2FFF FFFF space, the ing base address is 0x2000 0000, And the DM9000 Nic's own I/O base address, so the base address of the NIC on the TQ2440 Development Board is 0x2000 0300.

Therefore, we define the IO base address in the include/configs/tq2440.h header file as follows:

#define NONE_FLAG 0#if NONE_FLAG  #define CONFIG_CS8900       /* we have a CS8900 on-board */#define CONFIG_CS8900_BASE  0x19000300#define CONFIG_CS8900_BUS16 /* the Linux driver does accesses as shorts */#else#define CONFIG_DRIVER_DM9000+ #define CONFIG_DM9000_BASE 0x20000300#endif
Many documents and blogs on the Internet use the base address 0x2000 0000. Some netizens say that the base address 0x2000 0300 is because the CMD pin is connected to LADDR8. I think this is not true because of the previous analysis. Maybe my speculation is incorrect, but what can I do? If it is wrong, it should be treated as a failed removal experience! SA9 ~ 8 connected to the high level, so that SA9 ~ 4. the binary representation is 11 0000 0000, Which is exactly 0x300. This may be the reason for the H value (?)

Because DM9000 is the address and data port pins are reused, it is determined by the CMD pin. Here, the CMD pin is connected to LADDR2. If CMD is low, it is the address port, if it is high, it is the data port. Therefore, the DM9000 address port (Register address) is 0x2000 0300, and the data port (Register address) is 0x2000 0304. The tq2440.h file is defined as follows:

#else#define CONFIG_DRIVER_DM9000#define CONFIG_DM9000_BASE 0x20000300+ #define DM9000_IO CONFIG_DM9000_BASE+ #define DM9000_DATA (CONFIG_DM9000_BASE + 4)#endif


Our u-boot port 2440 is based on the 2410 template, because 2410 is not transplanted to the DM9000 Nic, so here we need to in the tq2440.c (board/samsung/tq2440/file) initialize the DM9000 Nic as follows:

#ifdef CONFIG_CMD_NETint board_eth_init(bd_t *bis){    int rc = 0;#ifdef CONFIG_CS8900    rc = cs8900_initialize(0, CONFIG_CS8900_BASE);#endif+ #ifdef CONFIG_DRIVER_DM9000+     rc = dm9000_initialize(bis);+ #endif    return rc;}#endif


The dm9000_initialize () function registers some operation functions that operate on the DM9000 Nic. The first address of the operation function is assigned to the struct of a network device, which unifies the operations on the network device.


Open the ping Network Operation Command macro:

#if NONE_FLAG#define CONFIG_CMD_DHCP#define CONFIG_CMD_ELF#define CONFIG_CMD_PING#define CONFIG_CMD_REGINFO#define CONFIG_CMD_USB+ #else+ #define CONFIG_CMD_PING#endif

To facilitate debugging, we also burned u-boot into the SDRAM, In the tq2440.h header file:

#define CONFIG_SYS_TEXT_BASE 0x33F00000 
Skip underlying initialization:

#define CONFIG_SKIP_LOWLEVEL_INIT


Compile, burn, and run (when burning and note that the starting address is 0x33F00000), print the following information:

Net: dm9000

Test DM9000

Make sure that your development board is connected to a network cable, set MAC, IP:

[TQ2440 #] set ethaddr 00:12:34:56:78:90[TQ2440 #] set ipaddr 192.168.169.9[TQ2440 #] save

Save is used to save the environment variables to NORflash.

The IP address of my ubuntu system server is 192.168.169.8. test whether the server can be pinged to the ubuntu Server:

[TQ2440 #] ping 192.168.169.8
Dm9000 I/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 00: 12: 34: 56: 78: 90
Cocould not establish link
Using dm9000 device
If host 192.168.169.8 is alive, it indicates that ping is successful.
[TQ2440 #]

This indicates that the DM9000 network function has been successfully transplanted. For u-boot, tftp is an important function and will be very helpful for future development. The following shows the tftp function:

First, make sure that the tftp service function is enabled for your ubuntu server. The tftp directory of my ubuntu server is/tftpboot. I will place any file in it:

u-boot-2014.10]$ vim /tftpboot/test1234567890

In u-boot, set the Server IP Address:

[TQ2440 #] set serverip 192.168.169.8[TQ2440 #] save

U-boot downloads the test file to the 0x3300 0000 address of SDRAM:

[TQ2440 #] tftpboot 33000000 test[TQ2440 #] md 33000000

33000000: 34333231 38373635 0a0a3039 4c220889 1234567890... "L

The tftp function is normal.


Modify base address

The strange thing is that I modified the base address of DM9000 and can still run it. This is a strange problem:

#define CONFIG_DM9000_BASE 0x20000000

Re-compile and run the program, with the same effect. This issue remains for further research.
















Related Article

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.