Skip to contentSkip to conversation

phy: add support for Amlogic Meson AXG MIPI-DSI PHY function

PATCH New Neil Armstrong 2 participants 8 messages Dec 29, 2020 – Jan 18, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover phy: add support for Amlogic Meson AXG MIPI-DSI PHY function

The Amlogic AXg SoCs embeds a MIPI D-PHY to communicate with DSI panels, this adds the bindings.

This D-PHY depends on a separate analog PHY.

The Amlogic AXG MIPI + PCIe Analog PHY provides function for both PCIe and MIPI DSI at the same time.

In order to configure the DSI PHY timings, a new "configure" PHY op is added to permit dynamic (re)configuration of the PHY function.

Finally, the Linux MIPI D-PHY configuration helpers are imported to provide a standard set of default D-PHY timings, timings struct and correct calculations.

Neil Armstrong (4):
phy: dphy: Add configuration helpers
generic-phy: add configure op
phy: Add Amlogic AXG MIPI D-PHY driver
phy: Add Amlogic AXG MIPI PCIe Analog PHY driver

 drivers/phy/Kconfig                      |  23 ++
 drivers/phy/Makefile                     |   3 +
 drivers/phy/meson-axg-mipi-dphy.c        | 393 +++++++++++++++++++++++
 drivers/phy/meson-axg-mipi-pcie-analog.c | 233 ++++++++++++++
 drivers/phy/phy-core-mipi-dphy.c         | 161 ++++++++++
 drivers/phy/phy-uclass.c                 |  11 +
 include/generic-phy.h                    |  23 ++
 include/phy-mipi-dphy.h                  | 284 ++++++++++++++++
 8 files changed, 1131 insertions(+)
 create mode 100644 drivers/phy/meson-axg-mipi-dphy.c
 create mode 100644 drivers/phy/meson-axg-mipi-pcie-analog.c
 create mode 100644 drivers/phy/phy-core-mipi-dphy.c
 create mode 100644 include/phy-mipi-dphy.h
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/4 phy: dphy: Add configuration helpers

The MIPI D-PHY spec defines default values and boundaries for most of the parameters it defines. Introduce helpers to help drivers get meaningful values based on their current parameters, and validate the boundaries of these parameters if needed.

These helpers and header are taken from Linux commit 9123e3a74ec7 ("Linux 5.9-rc1").

---
 drivers/phy/Kconfig              |   5 +
 drivers/phy/Makefile             |   1 +
 drivers/phy/phy-core-mipi-dphy.c | 161 ++++++++++++++++++
 include/phy-mipi-dphy.h          | 284 +++++++++++++++++++++++++++++++
 4 files changed, 451 insertions(+)
 create mode 100644 drivers/phy/phy-core-mipi-dphy.c
 create mode 100644 include/phy-mipi-dphy.h
drivers/phy/Kconfig +5 -0
index d12a6b02ad..8d9da17b53 100644
@@ -59,6 +59,11 @@ config SPL_NOP_PHY
 	  This is useful when a driver uses the PHY framework but no real PHY
 	  hardware exists.
 
+config MIPI_DPHY_HELPERS
+	bool "MIPI D-PHY support helpers"
+	help
+	  Provides a number of helpers a core functions for MIPI D-PHY drivers.
+
 config BCM6318_USBH_PHY
 	bool "BCM6318 USBH PHY support"
 	depends on PHY && ARCH_BMIPS
drivers/phy/Makefile +1 -0
index 45a7fe5b56..9024002822 100644
@@ -5,6 +5,7 @@
 
 obj-$(CONFIG_$(SPL_)PHY) += phy-uclass.o
 obj-$(CONFIG_$(SPL_)NOP_PHY) += nop-phy.o
+obj-$(CONFIG_MIPI_DPHY_HELPERS) += phy-core-mipi-dphy.o
 obj-$(CONFIG_BCM6318_USBH_PHY) += bcm6318-usbh-phy.o
 obj-$(CONFIG_BCM6348_USBH_PHY) += bcm6348-usbh-phy.o
 obj-$(CONFIG_BCM6358_USBH_PHY) += bcm6358-usbh-phy.o
drivers/phy/phy-core-mipi-dphy.c new file +161 -0

161 lines not on this page · raw message

include/phy-mipi-dphy.h new file +284 -0

284 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/4 generic-phy: add configure op

In reply to Neil Armstrong

Add the PHY configure op callback to the generic PHY uclass to permit configuring the PHY.

It's useful for MIPI DSI PHYs to setup the link timings.

---
 drivers/phy/phy-uclass.c | 11 +++++++++++
 include/generic-phy.h    | 23 +++++++++++++++++++++++
 2 files changed, 34 insertions(+)
drivers/phy/phy-uclass.c +11 -0
index ef03e3a502..43ffbcee0f 100644
@@ -204,6 +204,17 @@ int generic_phy_power_off(struct phy *phy)
 	return ret;
 }
 
+int generic_phy_configure(struct phy *phy, void *params)
+{
+	struct phy_ops const *ops;
+
+	if (!generic_phy_valid(phy))
+		return 0;
+	ops = phy_dev_ops(phy->dev);
+
+	return ops->configure ? ops->configure(phy, params) : 0;
+}
+
 int generic_phy_get_bulk(struct udevice *dev, struct phy_bulk *bulk)
 {
 	int i, ret, count;
include/generic-phy.h +23 -0
index 5ab34cda03..a17d900e4b 100644
@@ -122,6 +122,20 @@ struct phy_ops {
 	* @return 0 if OK, or a negative error code
 	*/
 	int	(*power_off)(struct phy *phy);
+
+	/**
+	* configure - configure a PHY device
+	*
+	* @phy:	PHY port to be configured
+	* @params: PHY Parameters, underlying data is specific to the PHY function
+	*
+	* During runtime, the PHY may need to be configured for it's main function.
+	* This function configures the PHY for it's main function following
+	* power_on/off() after beeing initialized.
+	*
+	* @return 0 if OK, or a negative error code
+	*/
+	int	(*configure)(struct phy *phy, void *params);
 };
 
 /**
@@ -183,6 +197,15 @@ int generic_phy_power_on(struct phy *phy);
  */
 int generic_phy_power_off(struct phy *phy);
 
+/**
+ * generic_phy_configure() - configure a PHY device
+ *
+ * @phy:	PHY port to be configured
+ * @params: 	PHY Parameters, underlying data is specific to the PHY function
+ * @return 0 if OK, or a negative error code
+ */
+int generic_phy_configure(struct phy *phy, void *params);
+
 
 /**
  * generic_phy_get_by_index() - Get a PHY device by integer index.
Signature · 1 line
2.25.1
#3 lore raw

PATCH 3/4 phy: Add Amlogic AXG MIPI D-PHY driver

In reply to Neil Armstrong

The Amlogic AXG SoCs embeds a MIPI D-PHY used to communicate with DSI panels.

This D-PHY depends on a separate analog PHY.

---
 drivers/phy/Kconfig               |   9 +
 drivers/phy/Makefile              |   1 +
 drivers/phy/meson-axg-mipi-dphy.c | 393 ++++++++++++++++++++++++++++++
 3 files changed, 403 insertions(+)
 create mode 100644 drivers/phy/meson-axg-mipi-dphy.c
drivers/phy/Kconfig +9 -0
index 8d9da17b53..00d77eef08 100644
@@ -196,6 +196,15 @@ config MESON_G12A_USB_PHY
 	  This is the generic phy driver for the Amlogic Meson G12A
 	  USB2 and USB3 PHYS.
 
+config MESON_AXG_MIPI_DPHY
+	bool "Amlogic Meson AXG MIPI D-PHY"
+	depends on PHY && ARCH_MESON && MESON_AXG
+	select MIPI_DPHY_HELPERS
+	imply REGMAP
+	help
+	  This is the generic phy driver for the Amlogic Meson AXG
+	  MIPI D-PHY.
+
 config MSM8916_USB_PHY
 	bool "Qualcomm MSM8916 USB PHY support"
 	depends on PHY
drivers/phy/Makefile +1 -0
index 9024002822..b2fd2d06f6 100644
@@ -22,6 +22,7 @@ obj-$(CONFIG_PHY_STM32_USBPHYC) += phy-stm32-usbphyc.o
 obj-$(CONFIG_MESON_GXBB_USB_PHY) += meson-gxbb-usb2.o
 obj-$(CONFIG_MESON_GXL_USB_PHY) += meson-gxl-usb2.o
 obj-$(CONFIG_MESON_G12A_USB_PHY) += meson-g12a-usb2.o meson-g12a-usb3-pcie.o
+obj-$(CONFIG_MESON_AXG_MIPI_DPHY) += meson-axg-mipi-dphy.o
 obj-$(CONFIG_MSM8916_USB_PHY) += msm8916-usbh-phy.o
 obj-$(CONFIG_OMAP_USB2_PHY) += omap-usb2-phy.o
 obj-$(CONFIG_KEYSTONE_USB_PHY) += keystone-usb-phy.o
drivers/phy/meson-axg-mipi-dphy.c new file +393 -0

393 lines not on this page · raw message

Signature · 1 line
2.25.1
#4 lore raw

PATCH 4/4 phy: Add Amlogic AXG MIPI PCIe Analog PHY driver

In reply to Neil Armstrong

The Amlogic AXG MIPI + PCIe Analog PHY provides function for both PCIe and MIPI DSI at the same time, and provides the Analog part of MIPI DSI transmission and Analog part of the PCIe lines.

---
 drivers/phy/Kconfig                      |   9 +
 drivers/phy/Makefile                     |   1 +
 drivers/phy/meson-axg-mipi-pcie-analog.c | 233 +++++++++++++++++++++++
 3 files changed, 243 insertions(+)
 create mode 100644 drivers/phy/meson-axg-mipi-pcie-analog.c
drivers/phy/Kconfig +9 -0
index 00d77eef08..e64802e8f3 100644
@@ -205,6 +205,15 @@ config MESON_AXG_MIPI_DPHY
 	  This is the generic phy driver for the Amlogic Meson AXG
 	  MIPI D-PHY.
 
+config MESON_AXG_MIPI_PCIE_ANALOG_PHY
+	bool "Amlogic Meson AXG MIPI PCIe Analog PHY"
+	depends on PHY && ARCH_MESON && MESON_AXG
+	select MIPI_DPHY_HELPERS
+	imply REGMAP
+	help
+	  This is the generic phy driver for the Amlogic Meson AXG
+	  MIPI PCIe Analog PHY.
+
 config MSM8916_USB_PHY
 	bool "Qualcomm MSM8916 USB PHY support"
 	depends on PHY
drivers/phy/Makefile +1 -0
index b2fd2d06f6..8daf9f6089 100644
@@ -23,6 +23,7 @@ obj-$(CONFIG_MESON_GXBB_USB_PHY) += meson-gxbb-usb2.o
 obj-$(CONFIG_MESON_GXL_USB_PHY) += meson-gxl-usb2.o
 obj-$(CONFIG_MESON_G12A_USB_PHY) += meson-g12a-usb2.o meson-g12a-usb3-pcie.o
 obj-$(CONFIG_MESON_AXG_MIPI_DPHY) += meson-axg-mipi-dphy.o
+obj-$(CONFIG_MESON_AXG_MIPI_PCIE_ANALOG_PHY) += meson-axg-mipi-pcie-analog.o
 obj-$(CONFIG_MSM8916_USB_PHY) += msm8916-usbh-phy.o
 obj-$(CONFIG_OMAP_USB2_PHY) += omap-usb2-phy.o
 obj-$(CONFIG_KEYSTONE_USB_PHY) += keystone-usb-phy.o
drivers/phy/meson-axg-mipi-pcie-analog.c new file +233 -0

233 lines not on this page · raw message

Signature · 1 line
2.25.1
#5 lore raw

cover phy: add support for Amlogic Meson AXG MIPI-DSI PHY function

In reply to Neil Armstrong

Hi Simon, Tom,

Could you review patches 1 & 2 of this serie ?

Thanks,
Neil

Quoted 34 lines · Neil Armstrong

The Amlogic AXg SoCs embeds a MIPI D-PHY to communicate with DSI panels, this adds the bindings.

This D-PHY depends on a separate analog PHY.

The Amlogic AXG MIPI + PCIe Analog PHY provides function for both PCIe and MIPI DSI at the same time.

In order to configure the DSI PHY timings, a new "configure" PHY op is added to permit dynamic (re)configuration of the PHY function.

Finally, the Linux MIPI D-PHY configuration helpers are imported to provide a standard set of default D-PHY timings, timings struct and correct calculations.

Neil Armstrong (4):
phy: dphy: Add configuration helpers
generic-phy: add configure op
phy: Add Amlogic AXG MIPI D-PHY driver
phy: Add Amlogic AXG MIPI PCIe Analog PHY driver

 drivers/phy/Kconfig                      |  23 ++
 drivers/phy/Makefile                     |   3 +
 drivers/phy/meson-axg-mipi-dphy.c        | 393 +++++++++++++++++++++++
 drivers/phy/meson-axg-mipi-pcie-analog.c | 233 ++++++++++++++
 drivers/phy/phy-core-mipi-dphy.c         | 161 ++++++++++
 drivers/phy/phy-uclass.c                 |  11 +
 include/generic-phy.h                    |  23 ++
 include/phy-mipi-dphy.h                  | 284 ++++++++++++++++
 8 files changed, 1131 insertions(+)
 create mode 100644 drivers/phy/meson-axg-mipi-dphy.c
 create mode 100644 drivers/phy/meson-axg-mipi-pcie-analog.c
 create mode 100644 drivers/phy/phy-core-mipi-dphy.c
 create mode 100644 include/phy-mipi-dphy.h
#6 lore raw

cover phy: add support for Amlogic Meson AXG MIPI-DSI PHY function

Quoted 3 lines · Neil Armstrong

Hi Simon, Tom,

Could you review patches 1 & 2 of this serie ?

Patches 1 and 2 look fine to me, FWIW.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210115/0471da35/attachment.sig>
#7 lore raw

cover phy: add support for Amlogic Meson AXG MIPI-DSI PHY function

In reply to Neil Armstrong
Quoted 20 lines · Neil Armstrong

The Amlogic AXg SoCs embeds a MIPI D-PHY to communicate with DSI panels, this adds the bindings.

This D-PHY depends on a separate analog PHY.

The Amlogic AXG MIPI + PCIe Analog PHY provides function for both PCIe and MIPI DSI at the same time.

In order to configure the DSI PHY timings, a new "configure" PHY op is added to permit dynamic (re)configuration of the PHY function.

Finally, the Linux MIPI D-PHY configuration helpers are imported to provide a standard set of default D-PHY timings, timings struct and correct calculations.

Neil Armstrong (4):
phy: dphy: Add configuration helpers
generic-phy: add configure op
phy: Add Amlogic AXG MIPI D-PHY driver
phy: Add Amlogic AXG MIPI PCIe Analog PHY driver

Quoted 14 lines
 drivers/phy/Kconfig                      |  23 ++
 drivers/phy/Makefile                     |   3 +
 drivers/phy/meson-axg-mipi-dphy.c        | 393 +++++++++++++++++++++++
 drivers/phy/meson-axg-mipi-pcie-analog.c | 233 ++++++++++++++
 drivers/phy/phy-core-mipi-dphy.c         | 161 ++++++++++
 drivers/phy/phy-uclass.c                 |  11 +
 include/generic-phy.h                    |  23 ++
 include/phy-mipi-dphy.h                  | 284 ++++++++++++++++
 8 files changed, 1131 insertions(+)
 create mode 100644 drivers/phy/meson-axg-mipi-dphy.c
 create mode 100644 drivers/phy/meson-axg-mipi-pcie-analog.c
 create mode 100644 drivers/phy/phy-core-mipi-dphy.c
 create mode 100644 include/phy-mipi-dphy.h

Applied to u-boot-amlogic

Neil