//zz//#########################################################
linux网卡phy-mii驱动mdio调试zz150120a
write:
@2015-1-19 12:27:39
@2015-1-20 9:36:54
@
REF:
linux-3.2.0srv-zz1412.pr
KeyWord:
电脑改为 100M 半双工
u-boot # mii write 1 4 101 去掉 1000M 支持则 eth0 可用
//zz//#########################################################
1.
内核中代码查找 mdiobus_write() 函数
但不知道怎么调用?
linux
drivers/net/phy/
phy_device.c
phy_register_fixup()
mdio_bus.c
mdiobus_write(struct mii_bus *, ...)
board-am335xevm.c
setup_myd_am335x()
phy_register_fixup_for_uid()
am33xx_evm_tx_clk_dly_phy_fixup()
phy_write()
mdiobus_write(struct mii_bus *, ...)
//zz//#########################################################
2.
内核中 net 驱动 phy 查找到配置如下
不知道内核在哪里根据 .features 来设置寄存器.
drivers/net/phy/Makefile
obj-$(CONFIG_REALTEK_PHY) += realtek.o
drivers/net/phy/
realtek.c
struct phy_driver rtl821x_driver = {
.phy_id = 0x001cc915,
.features = PHY_GBIT_FEATURES, //这个改为 100M 的全双工?
...
//zz// enable or disable interrupt.
// phy_write() => mdiobus_write() => davinci_mdio_write()
.config_intr = &rtl821x_config_intr,
...
}
//zz//#########################################################
3.
phy 芯片驱动 + mac芯片(ti am335x 中)驱动
通过 .config 及 Makefile 知道使用了哪些 .c 源码文件
1)
drivers/net/phy/
realtek.c
struct phy_driver rtl821x_driver = {
.phy_id = 0x001cc915,
.name = "RTL821x Gigabit Ethernet",
.phy_id_mask = 0x001fffff,
.features = PHY_GBIT_FEATURES, //z// 改为只支持100M半双工
...
}
2)
drivers/net/ethernet/ti/
cpsw.c
davinci_emac.c
davinci_mdio.c
...
platform_driver davinci_mdio_driver = {
.driver
.name = "davinci_mdio"
.probe = davinci_mdio_probe
}
3)
davinci_mdio_probe()
{
//z// mii_bus 结构体
data->bus = mdiobus_alloc();
//z// mdio 读写MAC的配置寄存器
data->bus->read = davinci_mdio_read,
data->bus->write = davinci_mdio_write,
//z// platform 资源 中断 等操作
//z// drivers/net/phy/
//z// mdio_bus.c 中框架函数的调用.
mdiobus_register()
}
4)
platform + "davinci_mdio" =>
arch/arm/mach-omap2/Omap_hwmod_33xx_data.c
am33xx_init_early() => am33xx_hwmod_init() => am33xx_hwmods => am33xx_mdio_hwmod => am33xx_mdio_hwmod_class => davinci_mdio => .name = davinci_mdio
arch/arm/mach-omap2/devices.c
omap_device_build() <= am33xx_cpsw_init("davinci_mdio"..&am33xx_cpsw_mdiopdata,)
<= am33xx_cpsw_init(AM33XX_CPSW_MODE_RGMII, "0:01", "0:02"); <= setup_myd_am335x()
am33xx_cpsw_mdiopdata => am33xx_cpsw_pdata => ...
struct cpsw_platform_data am33xx_cpsw_pdata =
{
}
struct cpsw_slave_data am33xx_cpsw_slaves[]
5)
platform + "cpsw" =>
drivers/net/ethernet/ti/
cpsw.c
platform_driver cpsw_driver =
{
.driver
.name = "cpsw"
.prob = cpsw_probe
}
cpsw_probe()
{
}
//zz//#########################################################
3.
利用 mdio_bus 初始化 rtl8211 芯片流程推测
rtl821x_driver
//z// 初始化函数为空?
.config_init = NULL,
//zz// phy_read() => mdiobus_read() => davinci_mdio_read()
.read_status = &genphy_read_status,
//zz// enable or disable interrupt.
// phy_write() => mdiobus_write() => davinci_mdio_write()
.config_intr = &rtl821x_config_intr,
//z// 这个不知道在哪被初始化的
.features = PHY_GBIT_FEATURES,
思路:
u-boot 可以使用 1000M Full 网卡功能
对比初始化
linux网卡phy-mii驱动mdio调试zz150120a
write:
@2015-1-19 12:27:39
@2015-1-20 9:36:54
@
REF:
linux-3.2.0srv-zz1412.pr
KeyWord:
电脑改为 100M 半双工
u-boot # mii write 1 4 101 去掉 1000M 支持则 eth0 可用
//zz//#########################################################
1.
内核中代码查找 mdiobus_write() 函数
但不知道怎么调用?
linux
drivers/net/phy/
phy_device.c
phy_register_fixup()
mdio_bus.c
mdiobus_write(struct mii_bus *, ...)
board-am335xevm.c
setup_myd_am335x()
phy_register_fixup_for_uid()
am33xx_evm_tx_clk_dly_phy_fixup()
phy_write()
mdiobus_write(struct mii_bus *, ...)
//zz//#########################################################
2.
内核中 net 驱动 phy 查找到配置如下
不知道内核在哪里根据 .features 来设置寄存器.
drivers/net/phy/Makefile
obj-$(CONFIG_REALTEK_PHY) += realtek.o
drivers/net/phy/
realtek.c
struct phy_driver rtl821x_driver = {
.phy_id = 0x001cc915,
.features = PHY_GBIT_FEATURES, //这个改为 100M 的全双工?
...
//zz// enable or disable interrupt.
// phy_write() => mdiobus_write() => davinci_mdio_write()
.config_intr = &rtl821x_config_intr,
...
}
//zz//#########################################################
3.
phy 芯片驱动 + mac芯片(ti am335x 中)驱动
通过 .config 及 Makefile 知道使用了哪些 .c 源码文件
1)
drivers/net/phy/
realtek.c
struct phy_driver rtl821x_driver = {
.phy_id = 0x001cc915,
.name = "RTL821x Gigabit Ethernet",
.phy_id_mask = 0x001fffff,
.features = PHY_GBIT_FEATURES, //z// 改为只支持100M半双工
...
}
2)
drivers/net/ethernet/ti/
cpsw.c
davinci_emac.c
davinci_mdio.c
...
platform_driver davinci_mdio_driver = {
.driver
.name = "davinci_mdio"
.probe = davinci_mdio_probe
}
3)
davinci_mdio_probe()
{
//z// mii_bus 结构体
data->bus = mdiobus_alloc();
//z// mdio 读写MAC的配置寄存器
data->bus->read = davinci_mdio_read,
data->bus->write = davinci_mdio_write,
//z// platform 资源 中断 等操作
//z// drivers/net/phy/
//z// mdio_bus.c 中框架函数的调用.
mdiobus_register()
}
4)
platform + "davinci_mdio" =>
arch/arm/mach-omap2/Omap_hwmod_33xx_data.c
am33xx_init_early() => am33xx_hwmod_init() => am33xx_hwmods => am33xx_mdio_hwmod => am33xx_mdio_hwmod_class => davinci_mdio => .name = davinci_mdio
arch/arm/mach-omap2/devices.c
omap_device_build() <= am33xx_cpsw_init("davinci_mdio"..&am33xx_cpsw_mdiopdata,)
<= am33xx_cpsw_init(AM33XX_CPSW_MODE_RGMII, "0:01", "0:02"); <= setup_myd_am335x()
am33xx_cpsw_mdiopdata => am33xx_cpsw_pdata => ...
struct cpsw_platform_data am33xx_cpsw_pdata =
{
}
struct cpsw_slave_data am33xx_cpsw_slaves[]
5)
platform + "cpsw" =>
drivers/net/ethernet/ti/
cpsw.c
platform_driver cpsw_driver =
{
.driver
.name = "cpsw"
.prob = cpsw_probe
}
cpsw_probe()
{
}
//zz//#########################################################
3.
利用 mdio_bus 初始化 rtl8211 芯片流程推测
rtl821x_driver
//z// 初始化函数为空?
.config_init = NULL,
//zz// phy_read() => mdiobus_read() => davinci_mdio_read()
.read_status = &genphy_read_status,
//zz// enable or disable interrupt.
// phy_write() => mdiobus_write() => davinci_mdio_write()
.config_intr = &rtl821x_config_intr,
//z// 这个不知道在哪被初始化的
.features = PHY_GBIT_FEATURES,
思路:
u-boot 可以使用 1000M Full 网卡功能
对比初始化
linux 内核中没有做初始化 config_init() 什么都没做? 还是说 features 有指定,但在哪呢?