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

来自百问网嵌入式Linux wiki
第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 */}}

2020年11月11日 (三) 09:34的版本

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

The STM32CubeMX tool can be used to configure the STM32MPU device and get the corresponding platform configuration device tree files.
The STM32CubeMX may not support all the properties described in the above 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.

References

Please refer to the following links for additional information:

<securetransclude src="ProtectedTemplate:PublicationRequestId" params="10329 | 2019-01-15 | AlainF"></securetransclude> <securetransclude src="ProtectedTemplate:ArticleBasedOnModel" params="Peripheral or framework device tree configuration model"></securetransclude>