U-boot network card drive Architecture

Source: Internet
Author: User
Tags call back

U-boot network card drive Architecture

Http://www.jollen.org/blog/2006/09/uboot_driver.html

Jollen posted on September 18,200 6 pm

Let's renew the PowerPC! Sort out the driver of this porting PowerPC network card. Today, we will sort out the priorities of the architecture.

To understand the following content, you must at least have basic knowledge about the following topics:

(1) how to use config _ * to define the driver for U-boot, you need to open the driver related to networking.
(2) U-boot startup and board-Level Initialization Process
(3) BSP architecture implementation method (extern) of U-boot)

(The U-boot staff of jollen can refer to Lecture 3 & Lecture 4)

Jollen is responsible for integrating the DST provided by vendor into U-boot to support the PHY (gigalan of Broadcom) on our PowerPC board ).

Net/ETH. C: eth_initialize ()

This is the core component of networking initialization.

Int eth_initialize (bd_t * bis)
{
Char enetvar [32], env_enetaddr [6];
Int I, eth_number = 0;
Char * TMP, * end;
Eth_devices = NULL;
Eth_current = NULL;

# If defined (config_mii) | (config_commands & cfg_cmd_mii)
Miiphy_init ();
# Endif
...
# Ifdef config_db64360
Mv6436x_eth_initialize (bis );
# Endif
...
# If defined (config_ppc750gige)
Ppc750_eth_initialize (bis );
# Endif
...
}

Here we can see a lot of driver definitions (config _ *). We will add the driver definition of our own board at the end. Ppc750_eth_initialize () is BSP code, so it must be implemented in the view of the Board. Then, the driver used as the PHY on the board/XXX/is based on the specification of the U-boot, we must put the driver of PHY under the view on the board.

Implement ppc750_eth_initialize ()

The next important task, of course, is to implement ppc750_eth_initialize (). When U-boot is on the machine, it will call the import point of our PHY driver, the input number is ppc750_eth_initialize (). The basic architecture of the driver for the Web card under U-boot is roughly the same. The following program introduction is the import point of our board's phy driver:

Int ppc750_eth_initialize (bd_t * bis) // called from eth. C: eth_initialize ()
{
Struct eth_device * Dev [max_num_eth_ports]; // The structure of the Ethernet device
Int I;

Printf ("Initializing Ethernet ports! \ N ");
For (I = 0; I <max_num_eth_ports; I ++)
{
If (Dev [I] = NULL ){
Dev [I] = (struct eth_device *) malloc (sizeof (struct eth_device ));
}

/* This is the most important thing. Fill in the actual number of Operation operations including init, halt, send, and Recv, let's take a look at the prototype of struct eth_device.
*/
Dev [I]-> init = ppc750_ether_init; // call init first when you run the loose command.
Dev [I]-> halt = ppc750_stop_ethernet; // call back when the network is disconnected.
Dev [I]-> send = ppc750_send_packet; // call back when the web Command sends packets.
Dev [I]-> Recv = ppc750_poll; // call back when receiving packets.

Eth_register (Dev [I]); // zookeeper Ethernet device to the U-boot core Kernel
}

Return I;
}

Here is the architecture provided by U-boot to the driver of the network card. Then, it is necessary to implement the init, halt, send, and Recv operations! The operation of the underlying volume driver is related to the hardware, that is, the work of the datasheet volume driver!

-- Jollen

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.