linux内核phy子系统

linux内核phy子系统

参考文档:
https://www.kernel.org/doc/html/latest/driver-api/phy/index.html
Generic PHY Framework

https://elixir.bootlin.com/linux/v6.8-rc6/source/Documentation/devicetree/bindings/phy/phy-bindings.txt

PHY is the abbreviation for physical layer.
PHY是物理层的缩写。

在这里插入图片描述

This framework will be of use only to devices that use external PHY (PHY functionality is not embedded within the controller).
该框架仅适用于使用外部PHY的设备(PHY功能未嵌入控制器中)

Inorder to dereference the private data (in phy_ops), the phy provider driver can use phy_set_drvdata() after creating the PHY and use phy_get_drvdata() in phy_ops to get back the private data.
为了取消引用私有数据(在phy_ops中),phy提供程序驱动程序可以在创建phy后使用phy_set_drvdata(),并在phy_op中使用phy_get_drvdata()来获取私有数据。

例如:如下PHY layer
如下图来自于:https://stephenzhou.blog.csdn.net/article/details/123648751 MIPI 系列之 DSI

在这里插入图片描述

例子:
https://elixir.bootlin.com/linux/v6.8-rc5/source/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c

数据类型是一个值的集合和定义在该集合上的一组操作的总称
数据类型是:一组值和一组操作

phy framework框架:Provider-Consumer 生产者消费者

phy驱动开发:
PHY provider:phy提供者
1,创建phy设备
2,关联phy设备相关的一组值和一组操作  
(即:phy设备的一组寄存器和一组对寄存器的操作函数)
3,注册phy设备

phy consumer: phy使用者
1,获取phy设备
2,操作phy设备

PHY provider:phy提供者 demo
devm_phy_create()
phy_set_drvdata()
phy_get_drvdata()
devm_of_phy_provider_register()

设备树:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
phy consumer: phy使用者 demo
devm_phy_optional_get()

The general order of calls should be:

[devm_][of_]phy_get()
phy_init()
phy_power_on()
[phy_set_mode[_ext]()]
...
phy_power_off()
phy_exit()
[[of_]phy_put()]

设备树:
phys = <&dsidphy>;
phy-names = “dphy”;

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
phy设备树
https://elixir.bootlin.com/linux/v6.8-rc6/source/Documentation/devicetree/bindings/phy/phy-bindings.txt

1, PHY device node
phys: phy {
    compatible = "xxx";
    reg = <...>;
    .
    .
    #phy-cells = <1>;
    .
    .
};

2, PHY user node
Example 1:
usb1: usb_otg_ss@xxx {
    compatible = "xxx";
    reg = <xxx>;
    .
    .
    phys = <&usb2_phy>, <&usb3_phy>;
    phy-names = "usb2phy", "usb3phy";
    .
    .
};


Example 2:
usb2: usb_otg_ss@xxx {
    compatible = "xxx";
    reg = <xxx>;
    .
    .
    phys = <&phys 1>;
    phy-names = "usbphy";
    .
    .
};
  • 25
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值