Documentation/driver-api/phy/samsung-usb2.rst

Source file repositories/reference/linux-study-clean/Documentation/driver-api/phy/samsung-usb2.rst

File Facts

System
Linux kernel
Corpus path
Documentation/driver-api/phy/samsung-usb2.rst
Extension
.rst
Size
4826 bytes
Lines
138
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

struct samsung_usb2_phy_config {
	const struct samsung_usb2_common_phy *phys;
	int (*rate_to_clk)(unsigned long, u32 *);
	unsigned int num_phys;
	bool has_mode_switch;
  };

The num_phys is the number of phys handled by the driver. `*phys` is an
array that contains the configuration for each phy. The has_mode_switch
property is a boolean flag that determines whether the SoC has USB host
and device on a single pair of pins. If so, a special register has to
be modified to change the internal routing of these pins between a USB
device or host module.

For example the configuration for Exynos 4210 is following::

  const struct samsung_usb2_phy_config exynos4210_usb2_phy_config = {
	.has_mode_switch        = 0,
	.num_phys		= EXYNOS4210_NUM_PHYS,
	.phys			= exynos4210_phys,
	.rate_to_clk		= exynos4210_rate_to_clk,
  }

- `int (*rate_to_clk)(unsigned long, u32 *)`

	The rate_to_clk callback is to convert the rate of the clock
	used as the reference clock for the PHY module to the value
	that should be written in the hardware register.

The exynos4210_phys configuration array is as follows::

  static const struct samsung_usb2_common_phy exynos4210_phys[] = {
	{
		.label		= "device",
		.id		= EXYNOS4210_DEVICE,
		.power_on	= exynos4210_power_on,
		.power_off	= exynos4210_power_off,
	},
	{
		.label		= "host",
		.id		= EXYNOS4210_HOST,
		.power_on	= exynos4210_power_on,
		.power_off	= exynos4210_power_off,
	},
	{
		.label		= "hsic0",
		.id		= EXYNOS4210_HSIC0,
		.power_on	= exynos4210_power_on,
		.power_off	= exynos4210_power_off,
	},
	{
		.label		= "hsic1",
		.id		= EXYNOS4210_HSIC1,
		.power_on	= exynos4210_power_on,
		.power_off	= exynos4210_power_off,
	},
	{},
  };

- `int (*power_on)(struct samsung_usb2_phy_instance *);`
  `int (*power_off)(struct samsung_usb2_phy_instance *);`

	These two callbacks are used to power on and power off the phy
	by modifying appropriate registers.

Final change to the driver is adding appropriate compatible value to the
phy-samsung-usb2.c file. In case of Exynos 4210 the following lines were
added to the struct of_device_id samsung_usb2_phy_of_match[] array::

  #ifdef CONFIG_PHY_EXYNOS4210_USB2

Annotation

Implementation Notes