Use of PHY chip (3) Transplantation of network PHY under linux

1 Introduction

For device tree configuration, please refer to the previous chapter. This explanation still takes Yutai's YT8511 chip as an example.

2 The files and paths that need to be configured

a. Add the yt_phy.c file in the ../drivers/net/phy directory (generally, the driver file is provided by the manufacturer);

b. Modify the Kconfig file in the ../drivers/net/phy directory, as shown in the figure below.

c. Modify the Makefile file in the ../drivers/net/phy directory, as shown in the figure below.

3 driver added

After completing the above content, enter the Linux kernel directory and execute make menuconfig to configure the kernel and add the YT PHY driver, as shown in the figure below.

4. Analysis of Transplantation Concerns

a. The porting of u-boot and Linux kernel PHY drivers is based on the standard software framework. Both u-boot and Linux kernel complete the matching of the PHY device device and the driver driver through the PHY ID. After the matching is successful, it is completed by calling the function (ytphy8511_config) Device tree analysis and PHY configuration operation;

b. During the u-boot transplant process, pay attention to phy_device->dev (struct udevice *dev, shown in Figure 1) is not its own udevice but the device information of gmac (as shown in Figure 2), and pay attention when analyzing the device tree node !

figure 1

figure 2

c. There are two channels of gmac (gmac0, gmac1) in the gmac, mdio, phy device nodes and attribute PS side of the device tree, and one channel of mdio (mdio0, mdio1) under gamc respectively. The configuration method of network-related device tree nodes is as follows: the root node contains gmac nodes, the gamc node contains subnodes mdio, and the mdio node contains subnodes phy, and mdio nodes can contain multiple phy subnodes.

Guess you like

Origin blog.csdn.net/weixin_44188399/article/details/131892897