“USBPHYC device tree configuration”的版本间的差异

来自百问网嵌入式Linux wiki
 
 
(未显示2个用户的7个中间版本)
第1行: 第1行:
[[Category:Linux_Operating_System]]
+
== Article purpose ==
[[Category:High_speed_interface]]
+
本文介绍了将[[USBPHYC internal peripheral|'''USBPHYC''' internal peripheral]] 分配给 Linux<sup>&reg;</sup> 时如何配置。 在这种情况下,它由[[PHY_overview|PHY framework]]控制。
[[Category:USB]]
+
 
 +
使用 [[Device tree|device tree]]机制执行配置。
 +
 
 +
“USBPHYC Linux驱动程序”<ref>{{CodeSource | Linux kernel | drivers/phy/st/phy-stm32-usbphyc.c}}, STM32 USB PHY Controller driver</ref> 它将相关信息注册在 [[PHY_overview|PHY framework]]中。
 +
 
 +
== DT bindings documentation ==
 +
“ USBPHYC设备树绑定”<ref name="phy-stm32-usbphyc.txt">{{CodeSource | Linux kernel | Documentation/devicetree/bindings/phy/phy-stm32-usbphyc.txt}}, USBPHYC device tree bindings</ref> 描述了所有必需和可选功能。
 +
USBPHYC
 +
      |_ PLL
 +
      |
 +
      |_ PHY port#1 _________________ HOST controller
 +
      |                    _                |
 +
      |                  / 1|________________|
 +
      |_ PHY port#2 ----|  |________________
 +
      |                  \_0|                |
 +
      |_ UTMI switch_______|          OTG controller
 +
 
 +
== DT configuration ==
 +
该硬件描述是“''STM32微处理器”''设备树文件(扩展名为.dtsi)和“''板子”设备树文件(扩展名为.dts)的组合。 有关设备树文件分割的说明,请参见 [[Device tree]]。
 +
 
 +
'''STM32CubeMX'''可用于生成板卡设备树。 有关更多详细信息,请参考 [[#How_to_configure_the_DT_using_STM32CubeMX|How to configure the DT using STM32CubeMX]] 。
 +
=== DT configuration (STM32 level) ===
 +
USBPHYC节点在stm32mp157c.dtsi<ref name="stm32mp157c_dtsi">{{CodeSource | Linux kernel | arch/arm/boot/dts/stm32mp157c.dtsi}}, STM32MP157C device tree file</ref>中声明。
 +
 
 +
* 根节点 '''usbphyc'''描述了USBPHYC硬件模块的参数,例如寄存器,时钟,复位和电源。
 +
* 子节点,例如 '''usbphyc_port0'''和'''usbphyc_port1'''描述了两个高速PHY端口:“端口#1”和“端口#2”。
 +
usbphyc: usbphyc@address {
 +
compatible = "st,stm32mp1-usbphyc";
 +
...                                        {{highlight|/* usbphyc resources: registers, clocks, resets and supplies */}}
 +
usbphyc_port0: usb-phy@0 {
 +
...                                {{highlight|/* usbphyc HS PHY port#1 */}}
 +
};
 +
usbphyc_port1: usb-phy@1 {
 +
...                                {{highlight|/* usbphyc HS PHY port#2 */}}
 +
};
 +
};
 +
{{Warning|该设备树部分与STM32微处理器有关。它必须保持原样,而不能由最终用户修改。}}
 +
 
 +
=== DT configuration (board level) ===
 +
请按照以下章节中描述的顺序在板上配置和启用USBPHYC。
 +
 
 +
'''' usbphyc'''' '''根节点'''必须填写:
 +
* 通过设置'''status =“ okay”。'''来启用USBPHYC模块。
 +
* 通过设置'''vdd3v3-supply = <&your_regulator>'''来配置USBPHYC 3V3稳压器[[Regulator overview]]</ref>。
 +
{{Info| USB HS PHY端口需要在VDD3V3_USBHS引脚上提供外部3V3电源。}}
 +
 
 +
可以调整每个端口的“子节点”:
 +
* 可选:创建一个'''usb_phy_tuning'''节点,该节点可以在DT根文件夹('/')中采用可选参数
 +
* 可选:在''' usbphyc_port0'''和/或''' usbphyc_port1'''节点中添加'''st,phy-tuning = <&usb_phy_tuning>'''以使用此调整。
 +
{{Info| 可能有必要调整phy设置以补偿寄生效应,这可能是由于USB连接器/插座,布线,ESD保护组件引起的。
 +
``USBPHYC设备树绑定''中提供了可选的调整参数列表<ref name="phy-stm32-usbphyc.txt"/>.}}
 +
 
 +
 
 +
=== DT configuration example ===
 +
以下示例显示了如何在板文件中启用和配置USBPHYC端口
 +
&usbphyc {
 +
vdd3v3-supply = <&vdd_usb>;                {{highlight|/* references the 3V3 voltage regulator on the user board */}}
 +
status = "okay";                            {{highlight|/* enable USB HS PHY controller */}}
 +
};
 +
 +
&usbphyc_port0 {
 +
st,phy-tuning = <&usb_phy_tuning>;          {{highlight|/* Optional USB HS PHY port#1 tuning */}}
 +
};
 +
 +
&usbphyc_port1 {
 +
st,phy-tuning = <&usb_phy_tuning>;          {{highlight|/* Optional USB HS PHY port#2 tuning */}}
 +
};
 +
 
 +
/ {                                                {{highlight|/* Optional USB HS PHY tuning example, to be added in DT root node, e.g. '/' */}}
 +
usb_phy_tuning: usb-phy-tuning {
 +
st,current-boost = <2>;
 +
st,no-lfs-fb-cap;
 +
st,hs-dc-level = <2>;
 +
st,hs-rftime-reduction;
 +
st,hs-current-trim = <5>;
 +
st,hs-impedance-trim = <0>;
 +
st,squelch-level = <1>;
 +
st,no-hs-ftime-ctrl;
 +
st,hs-tx-staggering;
 +
};
 +
};
 +
{{Info|UTMI开关的静态配置将'“端口#2”'分配给[[USBH_internal_peripheral|USBH]] or [[OTG_internal_peripheral|OTG]] ,这是通过'''PHY用户节点'''<ref>{{CodeSource | Linux kernel | Documentation/devicetree/bindings/phy/phy-bindings.txt}},PHY generic bindings</ref>:
 +
* 请参阅 [[USBH_device_tree_configuration]]
 +
* 请参阅 [[OTG_device_tree_configuration]]
 +
'''usbphyc_port1'''用户必须为UTMI开关配置其他说明符:'''0以选择OTG''','''1以选择USBH'''
 +
}}
 +
配置要分配给USBH的端口#2的示例摘要:
 +
&usbh_ehci {
 +
phys = <&usbphyc_port0>, <&usbphyc_port1 {{highlight|'''1'''}}>; {{highlight|/* '''1''': UTMI switch selects the USBH */}}
 +
phy-names = "usb", "usb";
 +
...
 +
}
 +
将端口2分配给OTG的示例摘要:
 +
&usbotg_hs {
 +
phys = <&usbphyc_port1 {{highlight|'''0'''}}>;                  {{highlight|/* '''0''': UTMI switch selects the OTG */}}
 +
phy-names = "usb2-phy";
 +
...
 +
}
 +
 
 +
==How to configure the DT using STM32CubeMX==
 +
[[STM32CubeMX]]工具可用于配置STM32MPU设备并获取相应的[[Device_tree#STM32|platform configuration device tree]] 文件。<br />
 +
STM32CubeMX可能不支持以上 [[#DT bindings documentation|DT bindings documentation]]段中描述的所有属性。 如果是这样,该工具会在生成的设备树中插入'''用户部分'''。 然后可以编辑这些部分以添加一些属性,并将它们一代一代地保留下来。 有关更多信息,请参见 [[STM32CubeMX]]用户手册。
 +
 
 +
==References==
 +
请参考以下链接以获取更多信息:
 +
 
 +
<references />

2020年11月11日 (三) 09:43的最新版本

Article purpose

本文介绍了将USBPHYC internal peripheral 分配给 Linux® 时如何配置。 在这种情况下,它由PHY framework控制。

使用 device tree机制执行配置。

“USBPHYC Linux驱动程序”[1] 它将相关信息注册在 PHY framework中。

DT bindings documentation

“ USBPHYC设备树绑定”[2] 描述了所有必需和可选功能。

USBPHYC
      |_ PLL
      |
      |_ PHY port#1 _________________ HOST controller
      |                    _                 |
      |                  / 1|________________|
      |_ PHY port#2 ----|   |________________
      |                  \_0|                |
      |_ UTMI switch_______|          OTG controller

DT configuration

该硬件描述是“STM32微处理器”设备树文件(扩展名为.dtsi)和“板子”设备树文件(扩展名为.dts)的组合。 有关设备树文件分割的说明,请参见 Device tree

STM32CubeMX可用于生成板卡设备树。 有关更多详细信息,请参考 How to configure the DT using STM32CubeMX

DT configuration (STM32 level)

USBPHYC节点在stm32mp157c.dtsi[3]中声明。

  • 根节点 usbphyc描述了USBPHYC硬件模块的参数,例如寄存器,时钟,复位和电源。
  • 子节点,例如 usbphyc_port0usbphyc_port1描述了两个高速PHY端口:“端口#1”和“端口#2”。
usbphyc: usbphyc@address {
	compatible = "st,stm32mp1-usbphyc";
	...                                         /* usbphyc resources: registers, clocks, resets and supplies */
	usbphyc_port0: usb-phy@0 {
		...                                 /* usbphyc HS PHY port#1 */
	};
	usbphyc_port1: usb-phy@1 {
		...                                 /* usbphyc HS PHY port#2 */
	};
};
Warning.png 该设备树部分与STM32微处理器有关。它必须保持原样,而不能由最终用户修改。

DT configuration (board level)

请按照以下章节中描述的顺序在板上配置和启用USBPHYC。

' usbphyc' 根节点必须填写:

  • 通过设置status =“ okay”。来启用USBPHYC模块。
  • 通过设置vdd3v3-supply = <&your_regulator>来配置USBPHYC 3V3稳压器Regulator overview</ref>。
Info.png USB HS PHY端口需要在VDD3V3_USBHS引脚上提供外部3V3电源。

可以调整每个端口的“子节点”:

  • 可选:创建一个usb_phy_tuning节点,该节点可以在DT根文件夹('/')中采用可选参数
  • 可选:在 usbphyc_port0和/或 usbphyc_port1节点中添加st,phy-tuning = <&usb_phy_tuning>以使用此调整。
Info.png 可能有必要调整phy设置以补偿寄生效应,这可能是由于USB连接器/插座,布线,ESD保护组件引起的。

``USBPHYC设备树绑定中提供了可选的调整参数列表[2].


DT configuration example

以下示例显示了如何在板文件中启用和配置USBPHYC端口

&usbphyc {
	vdd3v3-supply = <&vdd_usb>;                 /* references the 3V3 voltage regulator on the user board */
	status = "okay";                            /* enable USB HS PHY controller */
};

&usbphyc_port0 {
	st,phy-tuning = <&usb_phy_tuning>;          /* Optional USB HS PHY port#1 tuning */
};

&usbphyc_port1 {
	st,phy-tuning = <&usb_phy_tuning>;          /* Optional USB HS PHY port#2 tuning */
};
/ {                                                 /* Optional USB HS PHY tuning example, to be added in DT root node, e.g. '/' */
	usb_phy_tuning: usb-phy-tuning {
		st,current-boost = <2>;
		st,no-lfs-fb-cap;
		st,hs-dc-level = <2>;
		st,hs-rftime-reduction;
		st,hs-current-trim = <5>;
		st,hs-impedance-trim = <0>;
		st,squelch-level = <1>;
		st,no-hs-ftime-ctrl;
		st,hs-tx-staggering;
	};
};
Info.png UTMI开关的静态配置将'“端口#2”'分配给USBH or OTG ,这是通过PHY用户节点[4]:

usbphyc_port1用户必须为UTMI开关配置其他说明符:0以选择OTG1以选择USBH

配置要分配给USBH的端口#2的示例摘要:

&usbh_ehci {
	phys = <&usbphyc_port0>, <&usbphyc_port1 1>; /* 1: UTMI switch selects the USBH */
	phy-names = "usb", "usb";
	...
}

将端口2分配给OTG的示例摘要:

&usbotg_hs {
	phys = <&usbphyc_port1 0>;                  /* 0: UTMI switch selects the OTG */
	phy-names = "usb2-phy";
	...
}

How to configure the DT using STM32CubeMX

STM32CubeMX工具可用于配置STM32MPU设备并获取相应的platform configuration device tree 文件。
STM32CubeMX可能不支持以上 DT bindings documentation段中描述的所有属性。 如果是这样,该工具会在生成的设备树中插入用户部分。 然后可以编辑这些部分以添加一些属性,并将它们一代一代地保留下来。 有关更多信息,请参见 STM32CubeMX用户手册。