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

来自百问网嵌入式Linux wiki
 
(未显示同一用户的3个中间版本)
第19行: 第19行:
  
 
== DT configuration ==
 
== DT configuration ==
This hardware description is a combination of the '''STM32 microprocessor''' device tree files (''.dtsi'' extension) and '''board''' device tree files (''.dts'' extension). See the [[Device tree]] for an explanation of the device tree file split.
+
该硬件描述是“''STM32微处理器”''设备树文件(扩展名为.dtsi)和“''板子”设备树文件(扩展名为.dts)的组合。 有关设备树文件分割的说明,请参见 [[Device tree]]
  
'''STM32CubeMX''' can be used to generate the board device tree. Refer to [[#How_to_configure_the_DT_using_STM32CubeMX|How to configure the DT using STM32CubeMX]] for more details.
+
'''STM32CubeMX'''可用于生成板卡设备树。 有关更多详细信息,请参考 [[#How_to_configure_the_DT_using_STM32CubeMX|How to configure the DT using STM32CubeMX]]
 
=== DT configuration (STM32 level) ===
 
=== DT configuration (STM32 level) ===
The USBPHYC node is declared in stm32mp157c.dtsi<ref name="stm32mp157c_dtsi">{{CodeSource | Linux kernel | arch/arm/boot/dts/stm32mp157c.dtsi}}, STM32MP157C device tree file</ref>.
+
USBPHYC节点在stm32mp157c.dtsi<ref name="stm32mp157c_dtsi">{{CodeSource | Linux kernel | arch/arm/boot/dts/stm32mp157c.dtsi}}, STM32MP157C device tree file</ref>中声明。
  
* root node e.g. '''usbphyc''' describes the USBPHYC hardware block parameters such as registers, clocks, resets and supplies.
+
* 根节点 '''usbphyc'''描述了USBPHYC硬件模块的参数,例如寄存器,时钟,复位和电源。
* child nodes e.g. '''usbphyc_port0''' and '''usbphyc_port1''' describe the two high speed PHY ports: ''port#1'' and ''port#2''.
+
* 子节点,例如 '''usbphyc_port0''''''usbphyc_port1'''描述了两个高速PHY端口:“端口#1”和“端口#2”。
 
  usbphyc: usbphyc@address {
 
  usbphyc: usbphyc@address {
 
  compatible = "st,stm32mp1-usbphyc";
 
  compatible = "st,stm32mp1-usbphyc";
第37行: 第37行:
 
  };
 
  };
 
  };
 
  };
{{Warning|This device tree part is related to STM32 microprocessors. It must be kept as is, without being modified by the end-user.}}
+
{{Warning|该设备树部分与STM32微处理器有关。它必须保持原样,而不能由最终用户修改。}}
  
 
=== DT configuration (board level) ===
 
=== DT configuration (board level) ===
Follow the sequences described in the below chapters to configure and enable the USBPHYC on your board.
+
请按照以下章节中描述的顺序在板上配置和启用USBPHYC。
  
The ''''usbphyc'''' '''root node''' must be filled in:
+
'''' usbphyc'''' '''根节点'''必须填写:
* Enable the USBPHYC block by setting '''status = "okay".'''
+
* 通过设置'''status =“ okay”。'''来启用USBPHYC模块。
* Configure the USBPHYC 3V3 regulator<ref name="Regulator overview">[[Regulator overview]]</ref> by setting '''vdd3v3-supply = <&your_regulator>'''.
+
* 通过设置'''vdd3v3-supply = <&your_regulator>'''来配置USBPHYC 3V3稳压器[[Regulator overview]]</ref>
{{Info| USB HS PHY ports require an external 3V3 power supply to be provided at VDD3V3_USBHS pin.}}
+
{{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"/>.}}
  
The '''child nodes''' for each port may be tuned:
 
* Optional: create a '''usb_phy_tuning''' node that can take optional parameters in DT root folder ('/')
 
* Optional: add ''''st,phy-tuning = <&usb_phy_tuning>'''' in ''''usbphyc_port0'''' and/or ''''usbphyc_port1'''' node to use this tuning.
 
{{Info| It may be necessary to adjust the phy settings to compensate parasitics, which can be due to USB connector/receptacle, routing, ESD protection component.
 
Optional tuning parameter list is available in ''USBPHYC device tree bindings''<ref name="phy-stm32-usbphyc.txt"/>.}}
 
{{ReviewsComments|FGA W902: Later add reference link to the application note that explains how to tune these parameters (once published)}}
 
  
 
=== DT configuration example ===
 
=== DT configuration example ===
The example below shows how to enable and configure USBPHYC ports in the board file
+
以下示例显示了如何在板文件中启用和配置USBPHYC端口
 
  &usbphyc {
 
  &usbphyc {
 
  vdd3v3-supply = <&vdd_usb>;                {{highlight|/* references the 3V3 voltage regulator on the user board */}}
 
  vdd3v3-supply = <&vdd_usb>;                {{highlight|/* references the 3V3 voltage regulator on the user board */}}
第82行: 第82行:
 
  };
 
  };
 
  };
 
  };
{{Info| Static configuration of the UTMI switch to assign the '''port#2''' to either [[USBH_internal_peripheral|USBH]] or [[OTG_internal_peripheral|OTG]] is done by the '''PHY user node'''<ref>{{CodeSource | Linux kernel | Documentation/devicetree/bindings/phy/phy-bindings.txt}},PHY generic bindings</ref>:
+
{{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>:
* Please refer to [[USBH_device_tree_configuration]]
+
* 请参阅 [[USBH_device_tree_configuration]]
* Please refer to [[OTG_device_tree_configuration]]
+
* 请参阅 [[OTG_device_tree_configuration]]
'''usbphyc_port1''' user must configure an additional specifier for UTMI switch: '''0 to select OTG''', '''1 to select USBH'''
+
'''usbphyc_port1'''用户必须为UTMI开关配置其他说明符:'''0以选择OTG''''''1以选择USBH'''
 
}}
 
}}
Abstract of the example to configure port#2, to be assigned to the USBH:
+
配置要分配给USBH的端口#2的示例摘要:
 
  &usbh_ehci {
 
  &usbh_ehci {
 
  phys = <&usbphyc_port0>, <&usbphyc_port1 {{highlight|'''1'''}}>; {{highlight|/* '''1''': UTMI switch selects the USBH */}}
 
  phys = <&usbphyc_port0>, <&usbphyc_port1 {{highlight|'''1'''}}>; {{highlight|/* '''1''': UTMI switch selects the USBH */}}
第93行: 第93行:
 
  ...
 
  ...
 
  }
 
  }
Abstract of the example to configure port#2, to be assigned to the OTG:
+
将端口2分配给OTG的示例摘要:
 
  &usbotg_hs {
 
  &usbotg_hs {
 
  phys = <&usbphyc_port1 {{highlight|'''0'''}}>;                  {{highlight|/* '''0''': UTMI switch selects the OTG */}}
 
  phys = <&usbphyc_port1 {{highlight|'''0'''}}>;                  {{highlight|/* '''0''': UTMI switch selects the OTG */}}
第101行: 第101行:
  
 
==How to configure the DT using STM32CubeMX==
 
==How to configure the DT using STM32CubeMX==
The [[STM32CubeMX]] tool can be used to configure the STM32MPU device and get the corresponding [[Device_tree#STM32|platform configuration device tree]] files.<br />
+
[[STM32CubeMX]]工具可用于配置STM32MPU设备并获取相应的[[Device_tree#STM32|platform configuration device tree]] 文件。<br />
The STM32CubeMX may not support all the properties described in the above [[#DT bindings documentation|DT bindings documentation]] paragraph. If so, the tool inserts '''user sections''' in the generated device tree. These sections can then be edited to add some properties and they are preserved from one generation to another. Refer to [[STM32CubeMX]] user manual for further information.
+
STM32CubeMX可能不支持以上 [[#DT bindings documentation|DT bindings documentation]]段中描述的所有属性。 如果是这样,该工具会在生成的设备树中插入'''用户部分'''。 然后可以编辑这些部分以添加一些属性,并将它们一代一代地保留下来。 有关更多信息,请参见 [[STM32CubeMX]]用户手册。
  
 
==References==
 
==References==
Please refer to the following links for additional information:
+
请参考以下链接以获取更多信息:
  
 
<references />
 
<references />
 
<noinclude>
 
[[Category:Device tree configuration]]
 
[[Category:USB]]
 
{{PublicationRequestId | 10329 | 2019-01-15 | AlainF}}
 
{{ArticleBasedOnModel | Peripheral or framework device tree configuration model}}
 
</noinclude>
 

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用户手册。