Skip to contentSkip to conversation

Enable fastboot support for IPQ9574 based boards

PATCH New Varadarajan Narayanan via U-Boot 1 participant 6 messages Aug 6

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

cover Enable fastboot support for IPQ9574 based boards

This series enables MMC based fastboot flashing for IPQ9574 boards. For this the following are added/enabled
* USB2 & USB3 phys support
* USB Gadget support, Fastboot-MMC related configs
* Flashing related documentation

v3: - Rebase to top of tree
- Drop DT changes
- Pick up R-b tags
- Include Linux kernel version information in relevant commits
- Update documentation about 'n/w driver'
v2: https://lore.kernel.org/u-boot/[email protected]/

v2: Resend of https://lore.kernel.org/u-boot/[email protected]/#t
Rebased to latest top of tree
Updated author and Signed-off-by email id from quicinc.com to oss.qualcomm.com

---
Varadarajan Narayanan (5):
clk/qcom: Add USB related clocks for IPQ9574
phy: Add IPQ9574 support to Qualcomm QUSB2 phy
phy: qcom: Add QMP USB PHY driver
configs: ipq9574: Enable fastboot support
doc: board/qualcomm: Update RDP flashing instructions

 configs/qcom_ipq9574_mmc_defconfig                 |   18 +-
 doc/board/qualcomm/rdp.rst                         |   16 +
 drivers/clk/qcom/clock-ipq9574.c                   |   28 +
 drivers/phy/qcom/Kconfig                           |    8 +
 drivers/phy/qcom/Makefile                          |    1 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-misc-v4.h        |   17 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-usb-v5.h         |   36 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-usb-v6.h         |   17 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-usb-v7.h         |   17 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-usb-v8.h         |   38 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-v4_20.h          |   15 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-v5_20.h          |   21 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-v6-n4.h          |   32 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-v6.h             |    2 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-v7.h             |   34 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-v8.h             |   32 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-v8_50.h          |   13 +
 drivers/phy/qcom/phy-qcom-qmp-qserdes-com-v2.h     |  109 +
 drivers/phy/qcom/phy-qcom-qmp-qserdes-com-v6.h     |    7 +
 drivers/phy/qcom/phy-qcom-qmp-qserdes-com-v7.h     |   87 +
 drivers/phy/qcom/phy-qcom-qmp-qserdes-com-v8.h     |   75 +
 drivers/phy/qcom/phy-qcom-qmp-qserdes-com.h        |  231 +-
 drivers/phy/qcom/phy-qcom-qmp-qserdes-lalb-v8.h    |  639 ++++++
 drivers/phy/qcom/phy-qcom-qmp-qserdes-ln-shrd-v5.h |   11 +
 drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v2.h    |  205 ++
 drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v4_20.h |   43 +
 drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v5_20.h |   86 +
 .../phy/qcom/phy-qcom-qmp-qserdes-txrx-v5_5nm.h    |  328 +++
 drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v6.h    |    1 +
 drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v6_n4.h |   64 +
 drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v7.h    |   80 +
 drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v8.h    |   68 +
 drivers/phy/qcom/phy-qcom-qmp-ufs.c                |  136 +-
 drivers/phy/qcom/phy-qcom-qmp-usb.c                | 2198 ++++++++++++++++++++
 .../phy/qcom/phy-qcom-qmp-usb43-qserdes-com-v8.h   |  224 ++
 drivers/phy/qcom/phy-qcom-qmp.h                    |  142 +-
 drivers/phy/qcom/phy-qcom-qusb2.c                  |  356 +++-
 37 files changed, 5081 insertions(+), 354 deletions(-)

---
base-commit: baa64b2f892890f00a377eac4a3e685472bb56b5
change-id: 20260805-fastboot-fa492e2d87b8

Best regards,

Signature · 1 line
Varadarajan Narayanan <[email protected]>
#1 lore raw

PATCH 1/5 clk/qcom: Add USB related clocks for IPQ9574

Add the USB controller and phy related clocks.

---
 drivers/clk/qcom/clock-ipq9574.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
drivers/clk/qcom/clock-ipq9574.c +28 -0
index b0af4036059..1f5146b29a1 100644
@@ -25,6 +25,9 @@
 #define GCC_SDCC1_AHB_CBCR			0x33034
 #define GCC_SDCC1_APPS_CMD_RCGR			0x33004
 #define GCC_SDCC1_ICE_CORE_CBCR			0x33030
+#define GCC_USB0_MASTER_CMD_RCGR		0x2c004
+#define GCC_USB0_MOCK_UTMI_CMD_RCGR		0x2c02c
+#define GCC_USB0_AUX_CMD_RCGR			0x2C018
 
 static ulong ipq9574_set_rate(struct clk *clk, ulong rate)
 {
@@ -39,6 +42,17 @@ static ulong ipq9574_set_rate(struct clk *clk, ulong rate)
 		clk_rcg_set_rate_mnd(priv->base, GCC_SDCC1_APPS_CMD_RCGR,
 				     11, 0, 0, CFG_CLK_SRC_GPLL2, 16);
 		return rate;
+	case GCC_USB0_MASTER_CLK:
+		clk_rcg_set_rate(priv->base, GCC_USB0_MASTER_CMD_RCGR,
+				 4, CFG_CLK_SRC_GPLL0);
+		return rate;
+	case GCC_USB0_MOCK_UTMI_CLK:
+		clk_rcg_set_rate_mnd(priv->base, GCC_USB0_MOCK_UTMI_CMD_RCGR,
+				     0, 0, 0, CFG_CLK_SRC_CXO, 8);
+		return rate;
+	case GCC_USB0_AUX_CLK:
+		clk_rcg_set_rate_mnd(priv->base, GCC_USB0_AUX_CMD_RCGR, 0, 0, 0,
+				     CFG_CLK_SRC_CXO, 8);
 	default:
 		return -EINVAL;
 	}
@@ -50,6 +64,14 @@ static const struct gate_clk ipq9574_clks[] = {
 	GATE_CLK(GCC_SDCC1_AHB_CLK,		0x33034, 0x00000001),
 	GATE_CLK(GCC_SDCC1_APPS_CLK,		0x3302C, 0x00000001),
 	GATE_CLK(GCC_SDCC1_ICE_CORE_CLK,	0x33030, 0x00000001),
+	GATE_CLK(GCC_SNOC_USB_CLK,		0x2e058, 0x00000001),
+	GATE_CLK(GCC_USB0_MASTER_CLK,		0x2c044, 0x00000001),
+	GATE_CLK(GCC_ANOC_USB_AXI_CLK,		0x2e084, 0x00000001),
+	GATE_CLK(GCC_USB0_SLEEP_CLK,		0x2c058, 0x00000001),
+	GATE_CLK(GCC_USB0_MOCK_UTMI_CLK,	0x2c04c, 0x00000001),
+	GATE_CLK(GCC_USB0_PHY_CFG_AHB_CLK,	0x2c05c, 0x00000001),
+	GATE_CLK(GCC_USB0_AUX_CLK,		0x2c048, 0x00000001),
+	GATE_CLK(GCC_USB0_PIPE_CLK,		0x2c054, 0x00000001),
 };
 
 static int ipq9574_enable(struct clk *clk)
@@ -67,6 +89,10 @@ static int ipq9574_enable(struct clk *clk)
 }
 
 static const struct qcom_reset_map ipq9574_gcc_resets[] = {
+	[GCC_USB_BCR] = { 0x2c000 },
+	[GCC_QUSB2_0_PHY_BCR] = { 0x2c068 },
+	[GCC_USB0_PHY_BCR] = {0x2c06c, 0},
+	[GCC_USB3PHY_0_PHY_BCR] = {0x2c070, 0},
 	[GCC_SDCC_BCR] = { 0x33000 },
 };
 
@@ -75,6 +101,8 @@ static struct msm_clk_data ipq9574_gcc_data = {
 	.num_resets = ARRAY_SIZE(ipq9574_gcc_resets),
 	.enable = ipq9574_enable,
 	.set_rate = ipq9574_set_rate,
+	.clks = ipq9574_clks,
+	.num_clks = ARRAY_SIZE(ipq9574_clks),
 };
 
 static const struct udevice_id gcc_ipq9574_of_match[] = {
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/5 phy: Add IPQ9574 support to Qualcomm QUSB2 phy

In reply to Varadarajan Narayanan via U-Boot

Imported from Linux (v7.2-rc4) driver.

---
 drivers/phy/qcom/phy-qcom-qusb2.c | 356 +++++++++++++++++++++++++++++++-------
 1 file changed, 294 insertions(+), 62 deletions(-)
drivers/phy/qcom/phy-qcom-qusb2.c +294 -62
index 6278171b100..7a9cad7cacf 100644
@@ -15,81 +15,81 @@
 
 #include <dt-bindings/phy/phy-qcom-qusb2.h>
 
-#define QUSB2PHY_PLL 0x0
-#define QUSB2PHY_PLL_TEST 0x04
-#define CLK_REF_SEL BIT(7)
+#define QUSB2PHY_PLL			0x0
+#define QUSB2PHY_PLL_TEST		0x04
+#define CLK_REF_SEL			BIT(7)
 
-#define QUSB2PHY_PLL_TUNE 0x08
-#define QUSB2PHY_PLL_USER_CTL1 0x0c
-#define QUSB2PHY_PLL_USER_CTL2 0x10
-#define QUSB2PHY_PLL_AUTOPGM_CTL1 0x1c
-#define QUSB2PHY_PLL_PWR_CTRL 0x18
+#define QUSB2PHY_PLL_TUNE		0x08
+#define QUSB2PHY_PLL_USER_CTL1		0x0c
+#define QUSB2PHY_PLL_USER_CTL2		0x10
+#define QUSB2PHY_PLL_AUTOPGM_CTL1	0x1c
+#define QUSB2PHY_PLL_PWR_CTRL		0x18
 
 /* QUSB2PHY_PLL_STATUS register bits */
-#define PLL_LOCKED BIT(5)
+#define PLL_LOCKED			BIT(5)
 
 /* QUSB2PHY_PLL_COMMON_STATUS_ONE register bits */
-#define CORE_READY_STATUS BIT(0)
+#define CORE_READY_STATUS		BIT(0)
 
 /* QUSB2PHY_PORT_POWERDOWN register bits */
-#define CLAMP_N_EN BIT(5)
-#define FREEZIO_N BIT(1)
-#define POWER_DOWN BIT(0)
+#define CLAMP_N_EN			BIT(5)
+#define FREEZIO_N			BIT(1)
+#define POWER_DOWN			BIT(0)
 
 /* QUSB2PHY_PWR_CTRL1 register bits */
-#define PWR_CTRL1_VREF_SUPPLY_TRIM BIT(5)
-#define PWR_CTRL1_CLAMP_N_EN BIT(1)
+#define PWR_CTRL1_VREF_SUPPLY_TRIM	BIT(5)
+#define PWR_CTRL1_CLAMP_N_EN		BIT(1)
 
-#define QUSB2PHY_REFCLK_ENABLE BIT(0)
+#define QUSB2PHY_REFCLK_ENABLE		BIT(0)
 
-#define PHY_CLK_SCHEME_SEL BIT(0)
+#define PHY_CLK_SCHEME_SEL		BIT(0)
 
 /* QUSB2PHY_INTR_CTRL register bits */
-#define DMSE_INTR_HIGH_SEL BIT(4)
-#define DPSE_INTR_HIGH_SEL BIT(3)
-#define CHG_DET_INTR_EN BIT(2)
-#define DMSE_INTR_EN BIT(1)
-#define DPSE_INTR_EN BIT(0)
+#define DMSE_INTR_HIGH_SEL			BIT(4)
+#define DPSE_INTR_HIGH_SEL			BIT(3)
+#define CHG_DET_INTR_EN				BIT(2)
+#define DMSE_INTR_EN				BIT(1)
+#define DPSE_INTR_EN				BIT(0)
 
 /* QUSB2PHY_PLL_CORE_INPUT_OVERRIDE register bits */
-#define CORE_PLL_EN_FROM_RESET BIT(4)
-#define CORE_RESET BIT(5)
-#define CORE_RESET_MUX BIT(6)
+#define CORE_PLL_EN_FROM_RESET			BIT(4)
+#define CORE_RESET				BIT(5)
+#define CORE_RESET_MUX				BIT(6)
 
 /* QUSB2PHY_IMP_CTRL1 register bits */
-#define IMP_RES_OFFSET_MASK GENMASK(5, 0)
-#define IMP_RES_OFFSET_SHIFT 0x0
+#define IMP_RES_OFFSET_MASK			GENMASK(5, 0)
+#define IMP_RES_OFFSET_SHIFT			0x0
 
 /* QUSB2PHY_PLL_BIAS_CONTROL_2 register bits */
-#define BIAS_CTRL2_RES_OFFSET_MASK GENMASK(5, 0)
-#define BIAS_CTRL2_RES_OFFSET_SHIFT 0x0
+#define BIAS_CTRL2_RES_OFFSET_MASK		GENMASK(5, 0)
+#define BIAS_CTRL2_RES_OFFSET_SHIFT		0x0
 
 /* QUSB2PHY_CHG_CONTROL_2 register bits */
-#define CHG_CTRL2_OFFSET_MASK GENMASK(5, 4)
-#define CHG_CTRL2_OFFSET_SHIFT 0x4
+#define CHG_CTRL2_OFFSET_MASK			GENMASK(5, 4)
+#define CHG_CTRL2_OFFSET_SHIFT			0x4
 
 /* QUSB2PHY_PORT_TUNE1 register bits */
-#define HSTX_TRIM_MASK GENMASK(7, 4)
-#define HSTX_TRIM_SHIFT 0x4
-#define PREEMPH_WIDTH_HALF_BIT BIT(2)
-#define PREEMPHASIS_EN_MASK GENMASK(1, 0)
-#define PREEMPHASIS_EN_SHIFT 0x0
+#define HSTX_TRIM_MASK				GENMASK(7, 4)
+#define HSTX_TRIM_SHIFT				0x4
+#define PREEMPH_WIDTH_HALF_BIT			BIT(2)
+#define PREEMPHASIS_EN_MASK			GENMASK(1, 0)
+#define PREEMPHASIS_EN_SHIFT			0x0
 
 /* QUSB2PHY_PORT_TUNE2 register bits */
-#define HSDISC_TRIM_MASK GENMASK(1, 0)
-#define HSDISC_TRIM_SHIFT 0x0
+#define HSDISC_TRIM_MASK			GENMASK(1, 0)
+#define HSDISC_TRIM_SHIFT			0x0
 
-#define QUSB2PHY_PLL_ANALOG_CONTROLS_TWO 0x04
-#define QUSB2PHY_PLL_CLOCK_INVERTERS 0x18c
-#define QUSB2PHY_PLL_CMODE 0x2c
-#define QUSB2PHY_PLL_LOCK_DELAY 0x184
-#define QUSB2PHY_PLL_DIGITAL_TIMERS_TWO 0xb4
-#define QUSB2PHY_PLL_BIAS_CONTROL_1 0x194
-#define QUSB2PHY_PLL_BIAS_CONTROL_2 0x198
-#define QUSB2PHY_PWR_CTRL2 0x214
-#define QUSB2PHY_IMP_CTRL1 0x220
-#define QUSB2PHY_IMP_CTRL2 0x224
-#define QUSB2PHY_CHG_CTRL2 0x23c
+#define QUSB2PHY_PLL_ANALOG_CONTROLS_TWO	0x04
+#define QUSB2PHY_PLL_CLOCK_INVERTERS		0x18c
+#define QUSB2PHY_PLL_CMODE			0x2c
+#define QUSB2PHY_PLL_LOCK_DELAY			0x184
+#define QUSB2PHY_PLL_DIGITAL_TIMERS_TWO		0xb4
+#define QUSB2PHY_PLL_BIAS_CONTROL_1		0x194
+#define QUSB2PHY_PLL_BIAS_CONTROL_2		0x198
+#define QUSB2PHY_PWR_CTRL2			0x214
+#define QUSB2PHY_IMP_CTRL1			0x220
+#define QUSB2PHY_IMP_CTRL2			0x224
+#define QUSB2PHY_CHG_CTRL2			0x23c
 
 struct qusb2_phy_init_tbl {
 	unsigned int offset;
@@ -152,6 +152,35 @@ enum qusb2phy_reg_layout {
 		.offset = o, .val = v, .in_layout = 1, \
 	}
 
+static const struct qusb2_phy_init_tbl ipq6018_init_tbl[] = {
+	QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL, 0x14),
+	QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE1, 0xF8),
+	QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE2, 0xB3),
+	QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE3, 0x83),
+	QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE4, 0xC0),
+	QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_TUNE, 0x30),
+	QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_USER_CTL1, 0x79),
+	QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_USER_CTL2, 0x21),
+	QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE5, 0x00),
+	QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_PWR_CTRL, 0x00),
+	QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TEST2, 0x14),
+	QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_TEST, 0x80),
+	QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_AUTOPGM_CTL1, 0x9F),
+};
+
+static const unsigned int ipq6018_regs_layout[] = {
+	[QUSB2PHY_PLL_STATUS] = 0x38,
+	[QUSB2PHY_PORT_TUNE1] = 0x80,
+	[QUSB2PHY_PORT_TUNE2] = 0x84,
+	[QUSB2PHY_PORT_TUNE3] = 0x88,
+	[QUSB2PHY_PORT_TUNE4] = 0x8c,
+	[QUSB2PHY_PORT_TUNE5] = 0x90,
+	[QUSB2PHY_PORT_TEST1] = 0x98,
+	[QUSB2PHY_PORT_TEST2] = 0x9c,
+	[QUSB2PHY_PORT_POWERDOWN] = 0xb4,
+	[QUSB2PHY_INTR_CTRL] = 0xbc,
+};
+
 static const struct qusb2_phy_init_tbl sm6115_init_tbl[] = {
 	QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE1, 0xf8),
 	QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE2, 0x53),
@@ -176,19 +205,6 @@ static const unsigned int sm6115_regs_layout[] = {
 	[QUSB2PHY_PORT_POWERDOWN] = 0xb4, [QUSB2PHY_INTR_CTRL] = 0xbc,
 };
 
-static const unsigned int ipq6018_regs_layout[] = {
-	[QUSB2PHY_PLL_STATUS] = 0x38,
-	[QUSB2PHY_PORT_TUNE1] = 0x80,
-	[QUSB2PHY_PORT_TUNE2] = 0x84,
-	[QUSB2PHY_PORT_TUNE3] = 0x88,
-	[QUSB2PHY_PORT_TUNE4] = 0x8C,
-	[QUSB2PHY_PORT_TUNE5] = 0x90,
-	[QUSB2PHY_PORT_TEST1] = 0x98,
-	[QUSB2PHY_PORT_TEST2] = 0x9C,
-	[QUSB2PHY_PORT_POWERDOWN] = 0xB4,
-	[QUSB2PHY_INTR_CTRL] = 0xBC,
-};
-
 static const struct qusb2_phy_init_tbl msm8996_init_tbl[] = {
 	QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE1, 0xf8),
 	QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE2, 0xb3),
@@ -250,6 +266,17 @@ static const unsigned int qusb2_v2_regs_layout[] = {
 	[QUSB2PHY_INTR_CTRL] = 0x230,
 };
 
+static const struct qusb2_phy_cfg ipq6018_phy_cfg = {
+	.tbl            = ipq6018_init_tbl,
+	.tbl_num        = ARRAY_SIZE(ipq6018_init_tbl),
+	.regs           = ipq6018_regs_layout,
+
+	.disable_ctrl   = POWER_DOWN,
+	.mask_core_ready = PLL_LOCKED,
+	/* autoresume not used */
+	.autoresume_en   = BIT(0),
+};
+
 static const struct qusb2_phy_cfg msm8996_phy_cfg = {
 	.tbl = msm8996_init_tbl,
 	.tbl_num = ARRAY_SIZE(msm8996_init_tbl),
@@ -310,6 +337,34 @@ static const struct qusb2_phy_cfg qusb2_v2_phy_cfg = {
 	.update_tune1_with_efuse = true,
 };
 
+/* struct override_param - structure holding qusb2 v2 phy overriding param
+ * set override true if the  device tree property exists and read and assign
+ * to value
+ */
+struct override_param {
+	bool override;
+	u8 value;
+};
+
+/*struct override_params - structure holding qusb2 v2 phy overriding params
+ * @imp_res_offset: rescode offset to be updated in IMP_CTRL1 register
+ * @hstx_trim: HSTX_TRIM to be updated in TUNE1 register
+ * @preemphasis: Amplitude Pre-Emphasis to be updated in TUNE1 register
+ * @preemphasis_width: half/full-width Pre-Emphasis updated via TUNE1
+ * @bias_ctrl: bias ctrl to be updated in BIAS_CONTROL_2 register
+ * @charge_ctrl: charge ctrl to be updated in CHG_CTRL2 register
+ * @hsdisc_trim: disconnect threshold to be updated in TUNE2 register
+ */
+struct override_params {
+	struct override_param imp_res_offset;
+	struct override_param hstx_trim;
+	struct override_param preemphasis;
+	struct override_param preemphasis_width;
+	struct override_param bias_ctrl;
+	struct override_param charge_ctrl;
+	struct override_param hsdisc_trim;
+};
+
 /**
  * struct qusb2_phy - structure holding qusb2 phy attributes
  *
@@ -317,6 +372,8 @@ static const struct qusb2_phy_cfg qusb2_v2_phy_cfg = {
  * @base: iomapped memory space for qubs2 phy
  *
  * @cfg_ahb_clk: AHB2PHY interface clock
+ * @ref_clk: phy reference clock
+ * @iface_clk: phy interface clock
  * @phy_rst: phy reset control
  *
  * @cfg: phy config data
@@ -327,12 +384,56 @@ struct qusb2_phy {
 	void __iomem *base;
 
 	struct clk cfg_ahb_clk;
+	struct clk ref_clk;
+	struct clk iface_clk;
 	struct reset_ctl phy_rst;
 
+	struct override_params overrides;
+
 	const struct qusb2_phy_cfg *cfg;
 	bool has_se_clk_scheme;
+	bool phy_initialized;
+	enum phy_mode mode;
 };
 
+static inline void qusb2_write_mask(void __iomem *base, u32 offset,
+				    u32 val, u32 mask)
+{
+	u32 reg;
+
+	reg = readl(base + offset);
+	reg &= ~mask;
+	reg |= val & mask;
+	writel(reg, base + offset);
+
+	/* Ensure above write is completed */
+	readl(base + offset);
+}
+
+static inline void qusb2_setbits(void __iomem *base, u32 offset, u32 val)
+{
+	u32 reg;
+
+	reg = readl(base + offset);
+	reg |= val;
+	writel(reg, base + offset);
+
+	/* Ensure above write is completed */
+	readl(base + offset);
+}
+
+static inline void qusb2_clrbits(void __iomem *base, u32 offset, u32 val)
+{
+	u32 reg;
+
+	reg = readl(base + offset);
+	reg &= ~val;
+	writel(reg, base + offset);
+
+	/* Ensure above write is completed */
+	readl(base + offset);
+}
+
 static inline void qusb2_phy_configure(void __iomem *base,
 				       const unsigned int *regs,
 				       const struct qusb2_phy_init_tbl tbl[],
@@ -348,6 +449,68 @@ static inline void qusb2_phy_configure(void __iomem *base,
 	}
 }
 
+/*
+ * Update board specific PHY tuning override values if specified from
+ * device tree.
+ */
+static void qusb2_phy_override_phy_params(struct qusb2_phy *qphy)
+{
+	const struct qusb2_phy_cfg *cfg = qphy->cfg;
+	struct override_params *or = &qphy->overrides;
+
+	if (or->imp_res_offset.override)
+		qusb2_write_mask(qphy->base, QUSB2PHY_IMP_CTRL1,
+		or->imp_res_offset.value << IMP_RES_OFFSET_SHIFT,
+			     IMP_RES_OFFSET_MASK);
+
+	if (or->bias_ctrl.override)
+		qusb2_write_mask(qphy->base, QUSB2PHY_PLL_BIAS_CONTROL_2,
+		or->bias_ctrl.value << BIAS_CTRL2_RES_OFFSET_SHIFT,
+			   BIAS_CTRL2_RES_OFFSET_MASK);
+
+	if (or->charge_ctrl.override)
+		qusb2_write_mask(qphy->base, QUSB2PHY_CHG_CTRL2,
+		or->charge_ctrl.value << CHG_CTRL2_OFFSET_SHIFT,
+			     CHG_CTRL2_OFFSET_MASK);
+
+	if (or->hstx_trim.override)
+		qusb2_write_mask(qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE1],
+		or->hstx_trim.value << HSTX_TRIM_SHIFT,
+				 HSTX_TRIM_MASK);
+
+	if (or->preemphasis.override)
+		qusb2_write_mask(qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE1],
+		or->preemphasis.value << PREEMPHASIS_EN_SHIFT,
+				PREEMPHASIS_EN_MASK);
+
+	if (or->preemphasis_width.override) {
+		if (or->preemphasis_width.value ==
+		    QUSB2_V2_PREEMPHASIS_WIDTH_HALF_BIT)
+			qusb2_setbits(qphy->base,
+				      cfg->regs[QUSB2PHY_PORT_TUNE1],
+				      PREEMPH_WIDTH_HALF_BIT);
+		else
+			qusb2_clrbits(qphy->base,
+				      cfg->regs[QUSB2PHY_PORT_TUNE1],
+				      PREEMPH_WIDTH_HALF_BIT);
+	}
+
+	if (or->hsdisc_trim.override)
+		qusb2_write_mask(qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE2],
+		or->hsdisc_trim.value << HSDISC_TRIM_SHIFT,
+				 HSDISC_TRIM_MASK);
+}
+
+static int qusb2_phy_set_mode(struct phy *phy,
+			      enum phy_mode mode, int submode)
+{
+	struct qusb2_phy *qphy = dev_get_priv(phy->dev);
+
+	qphy->mode = mode;
+
+	return 0;
+}
+
 static int qusb2phy_do_reset(struct qusb2_phy *qphy)
 {
 	int ret;
@@ -387,6 +550,9 @@ static int qusb2phy_power_on(struct phy *phy)
 
 	qusb2_phy_configure(qphy->base, cfg->regs, cfg->tbl, cfg->tbl_num);
 
+	/* Override board specific PHY tuning values */
+	qusb2_phy_override_phy_params(qphy);
+
 	/* Enable the PHY */
 	clrbits_le32(qphy->base + cfg->regs[QUSB2PHY_PORT_POWERDOWN],
 		     POWER_DOWN);
@@ -401,6 +567,12 @@ static int qusb2phy_power_on(struct phy *phy)
 	 */
 	qphy->has_se_clk_scheme = cfg->se_clk_scheme_default;
 
+	if (!qphy->has_se_clk_scheme) {
+		ret = clk_enable(&qphy->ref_clk);
+		if (ret)
+			return ret;
+	}
+
 	if (cfg->has_pll_test) {
 		if (!qphy->has_se_clk_scheme)
 			val &= ~CLK_REF_SEL;
@@ -437,6 +609,8 @@ static int qusb2phy_power_off(struct phy *phy)
 	reset_assert(&qphy->phy_rst);
 
 	clk_disable(&qphy->cfg_ahb_clk);
+	clk_disable(&qphy->ref_clk);
+	clk_disable(&qphy->iface_clk);
 
 	return 0;
 }
@@ -454,6 +628,22 @@ static int qusb2phy_clk_init(struct udevice *dev, struct qusb2_phy *qphy)
 	if (ret)
 		return ret;
 
+	ret = clk_get_by_name(dev, "ref", &qphy->ref_clk);
+	if (ret == -ENOSYS || ret == -ENOENT)
+		return 0;
+	if (ret)
+		return ret;
+
+	ret = clk_get_by_name(dev, "iface", &qphy->iface_clk);
+	if (ret == -ENOSYS || ret == -ENOENT)
+		return 0;
+	if (ret)
+		return ret;
+
+	ret = clk_enable(&qphy->iface_clk);
+	if (ret)
+		return ret;
+
 	ret = clk_enable(&qphy->cfg_ahb_clk);
 	if (ret)
 		return ret;
@@ -464,6 +654,8 @@ static int qusb2phy_clk_init(struct udevice *dev, struct qusb2_phy *qphy)
 static int qusb2phy_probe(struct udevice *dev)
 {
 	struct qusb2_phy *qphy = dev_get_priv(dev);
+	struct override_params *or;
+	u32 value;
 	int ret;
 
 	qphy->base = (void __iomem *)dev_read_addr(dev);
@@ -488,6 +680,43 @@ static int qusb2phy_probe(struct udevice *dev)
 		return -EINVAL;
 	}
 
+	or = &qphy->overrides;
+
+	if (!dev_read_u32(dev, "qcom,imp-res-offset-value", &value)) {
+		or->imp_res_offset.value = (u8)value;
+		or->imp_res_offset.override = true;
+	}
+
+	if (!dev_read_u32(dev, "qcom,bias-ctrl-value", &value)) {
+		or->bias_ctrl.value = (u8)value;
+		or->bias_ctrl.override = true;
+	}
+
+	if (!dev_read_u32(dev, "qcom,charge-ctrl-value", &value)) {
+		or->charge_ctrl.value = (u8)value;
+		or->charge_ctrl.override = true;
+	}
+
+	if (!dev_read_u32(dev, "qcom,hstx-trim-value", &value)) {
+		or->hstx_trim.value = (u8)value;
+		or->hstx_trim.override = true;
+	}
+
+	if (!dev_read_u32(dev, "qcom,preemphasis-level", &value)) {
+		or->preemphasis.value = (u8)value;
+		or->preemphasis.override = true;
+	}
+
+	if (!dev_read_u32(dev, "qcom,preemphasis-width", &value)) {
+		or->preemphasis_width.value = (u8)value;
+		or->preemphasis_width.override = true;
+	}
+
+	if (!dev_read_u32(dev, "qcom,hsdisc-trim-value", &value)) {
+		or->hsdisc_trim.value = (u8)value;
+		or->hsdisc_trim.override = true;
+	}
+
 	debug("%s success qusb phy cfg %p\n", __func__, qphy->cfg);
 	return 0;
 }
@@ -495,6 +724,7 @@ static int qusb2phy_probe(struct udevice *dev)
 static struct phy_ops qusb2phy_ops = {
 	.power_on = qusb2phy_power_on,
 	.power_off = qusb2phy_power_off,
+	.set_mode = qusb2_phy_set_mode,
 };
 
 static const struct udevice_id qusb2phy_ids[] = {
@@ -507,6 +737,8 @@ static const struct udevice_id qusb2phy_ids[] = {
 	  .data = (ulong)&qcs615_phy_cfg },
 	{ .compatible = "qcom,sdm660-qusb2-phy",
 	  .data = (ulong)&sdm660_phy_cfg },
+	{ .compatible = "qcom,ipq9574-qusb2-phy",
+	  .data = (ulong)&ipq6018_phy_cfg },
 	{ .compatible = "qcom,sm6115-qusb2-phy",
 	  .data = (ulong)&sm6115_phy_cfg },
 	{ .compatible = "qcom,qusb2-v2-phy", .data = (ulong)&qusb2_v2_phy_cfg },
Signature · 1 line
2.34.1
#3 lore raw

PATCH 3/5 phy: qcom: Add QMP USB PHY driver

In reply to Varadarajan Narayanan via U-Boot

Port Qualcomm QMP USB PHY driver from Linux (v7.2-rc4). This PHY is available in many Qcom SoCs. Enabled and tested the driver on IPQ9574.

---
 drivers/phy/qcom/Kconfig                           |    8 +
 drivers/phy/qcom/Makefile                          |    1 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-misc-v4.h        |   17 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-usb-v5.h         |   36 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-usb-v6.h         |   17 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-usb-v7.h         |   17 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-usb-v8.h         |   38 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-v4_20.h          |   15 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-v5_20.h          |   21 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-v6-n4.h          |   32 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-v6.h             |    2 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-v7.h             |   34 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-v8.h             |   32 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-v8_50.h          |   13 +
 drivers/phy/qcom/phy-qcom-qmp-qserdes-com-v2.h     |  109 +
 drivers/phy/qcom/phy-qcom-qmp-qserdes-com-v6.h     |    7 +
 drivers/phy/qcom/phy-qcom-qmp-qserdes-com-v7.h     |   87 +
 drivers/phy/qcom/phy-qcom-qmp-qserdes-com-v8.h     |   75 +
 drivers/phy/qcom/phy-qcom-qmp-qserdes-com.h        |  231 +-
 drivers/phy/qcom/phy-qcom-qmp-qserdes-lalb-v8.h    |  639 ++++++
 drivers/phy/qcom/phy-qcom-qmp-qserdes-ln-shrd-v5.h |   11 +
 drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v2.h    |  205 ++
 drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v4_20.h |   43 +
 drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v5_20.h |   86 +
 .../phy/qcom/phy-qcom-qmp-qserdes-txrx-v5_5nm.h    |  328 +++
 drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v6.h    |    1 +
 drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v6_n4.h |   64 +
 drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v7.h    |   80 +
 drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v8.h    |   68 +
 drivers/phy/qcom/phy-qcom-qmp-ufs.c                |  136 +-
 drivers/phy/qcom/phy-qcom-qmp-usb.c                | 2198 ++++++++++++++++++++
 .../phy/qcom/phy-qcom-qmp-usb43-qserdes-com-v8.h   |  224 ++
 drivers/phy/qcom/phy-qcom-qmp.h                    |  142 +-
 33 files changed, 4726 insertions(+), 291 deletions(-)
drivers/phy/qcom/Kconfig +8 -0
index 1fdadaccb12..38f46dd2ec1 100644
@@ -32,6 +32,14 @@ config PHY_QCOM_QMP_UFS
 	help
 	  Enable this to support the UFS QMP PHY on various Qualcomm chipsets.
 
+config PHY_QCOM_QMP_USB
+	bool "Qualcomm QMP USB PHY Driver"
+	select GENERIC_PHY
+	default PHY_QCOM_QMP
+	help
+	  Enable this to support the QMP USB PHY transceiver that is used
+	  with USB3 controllers on Qualcomm chips.
+
 config PHY_QCOM_QUSB2
 	bool "Qualcomm USB QUSB2 PHY driver"
 	depends on PHY && ARCH_SNAPDRAGON
drivers/phy/qcom/Makefile +1 -0
index 714013dc572..7ede50e6bc1 100644
@@ -3,6 +3,7 @@ obj-$(CONFIG_MSM8916_USB_PHY) += msm8916-usbh-phy.o
 obj-$(CONFIG_PHY_QCOM_QMP_COMBO) += phy-qcom-qmp-combo.o
 obj-$(CONFIG_PHY_QCOM_QMP_PCIE) += phy-qcom-qmp-pcie.o
 obj-$(CONFIG_PHY_QCOM_QMP_UFS) += phy-qcom-qmp-ufs.o
+obj-$(CONFIG_PHY_QCOM_QMP_USB) += phy-qcom-qmp-usb.o
 obj-$(CONFIG_PHY_QCOM_QUSB2) += phy-qcom-qusb2.o
 obj-$(CONFIG_PHY_QCOM_USB_SNPS_FEMTO_V2) += phy-qcom-snps-femto-v2.o
 obj-$(CONFIG_PHY_QCOM_SNPS_EUSB2) += phy-qcom-snps-eusb2.o
drivers/phy/qcom/phy-qcom-qmp-pcs-misc-v4.h new file +17 -0
new file mode 100644
index 00000000000..e256a089f22
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ */
+
+#ifndef QCOM_PHY_QMP_PCS_MISC_V4_H_
+#define QCOM_PHY_QMP_PCS_MISC_V4_H_
+
+/* Only for QMP V4 PHY - PCS_MISC registers */
+#define QPHY_V4_PCS_MISC_TYPEC_CTRL			0x00
+#define QPHY_V4_PCS_MISC_TYPEC_PWRDN_CTRL		0x04
+#define QPHY_V4_PCS_MISC_PCS_MISC_CONFIG1		0x08
+#define QPHY_V4_PCS_MISC_CLAMP_ENABLE			0x0c
+#define QPHY_V4_PCS_MISC_TYPEC_STATUS			0x10
+#define QPHY_V4_PCS_MISC_PLACEHOLDER_STATUS		0x14
+
+#endif
drivers/phy/qcom/phy-qcom-qmp-pcs-usb-v5.h new file +36 -0
new file mode 100644
index 00000000000..73de626223e
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ */
+
+#ifndef QCOM_PHY_QMP_PCS_USB_V5_H_
+#define QCOM_PHY_QMP_PCS_USB_V5_H_
+
+/* Only for QMP V5 PHY - USB3 have different offsets than V4 */
+#define QPHY_V5_PCS_USB3_POWER_STATE_CONFIG1		0x000
+#define QPHY_V5_PCS_USB3_AUTONOMOUS_MODE_STATUS		0x004
+#define QPHY_V5_PCS_USB3_AUTONOMOUS_MODE_CTRL		0x008
+#define QPHY_V5_PCS_USB3_AUTONOMOUS_MODE_CTRL2		0x00c
+#define QPHY_V5_PCS_USB3_LFPS_RXTERM_IRQ_SOURCE_STATUS	0x010
+#define QPHY_V5_PCS_USB3_LFPS_RXTERM_IRQ_CLEAR		0x014
+#define QPHY_V5_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL	0x018
+#define QPHY_V5_PCS_USB3_LFPS_TX_ECSTART		0x01c
+#define QPHY_V5_PCS_USB3_LFPS_PER_TIMER_VAL		0x020
+#define QPHY_V5_PCS_USB3_LFPS_TX_END_CNT_U3_START	0x024
+#define QPHY_V5_PCS_USB3_LFPS_CONFIG1			0x028
+#define QPHY_V5_PCS_USB3_RXEQTRAINING_LOCK_TIME		0x02c
+#define QPHY_V5_PCS_USB3_RXEQTRAINING_WAIT_TIME		0x030
+#define QPHY_V5_PCS_USB3_RXEQTRAINING_CTLE_TIME		0x034
+#define QPHY_V5_PCS_USB3_RXEQTRAINING_WAIT_TIME_S2	0x038
+#define QPHY_V5_PCS_USB3_RXEQTRAINING_DFE_TIME_S2	0x03c
+#define QPHY_V5_PCS_USB3_RCVR_DTCT_DLY_U3_L		0x040
+#define QPHY_V5_PCS_USB3_RCVR_DTCT_DLY_U3_H		0x044
+#define QPHY_V5_PCS_USB3_ARCVR_DTCT_EN_PERIOD		0x048
+#define QPHY_V5_PCS_USB3_ARCVR_DTCT_CM_DLY		0x04c
+#define QPHY_V5_PCS_USB3_TXONESZEROS_RUN_LENGTH		0x050
+#define QPHY_V5_PCS_USB3_ALFPS_DEGLITCH_VAL		0x054
+#define QPHY_V5_PCS_USB3_SIGDET_STARTUP_TIMER_VAL	0x058
+#define QPHY_V5_PCS_USB3_TEST_CONTROL			0x05c
+#define QPHY_V5_PCS_USB3_RXTERMINATION_DLY_SEL		0x060
+
+#endif
drivers/phy/qcom/phy-qcom-qmp-pcs-usb-v6.h new file +17 -0
new file mode 100644
index 00000000000..df670143feb
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2022, The Linux Foundation. All rights reserved.
+ */
+
+#ifndef QCOM_PHY_QMP_PCS_USB_V6_H_
+#define QCOM_PHY_QMP_PCS_USB_V6_H_
+
+#define QPHY_V6_PCS_USB3_POWER_STATE_CONFIG1		0x00
+#define QPHY_V6_PCS_USB3_AUTONOMOUS_MODE_CTRL		0x08
+#define QPHY_V6_PCS_USB3_LFPS_RXTERM_IRQ_CLEAR		0x14
+#define QPHY_V6_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL	0x18
+#define QPHY_V6_PCS_USB3_RXEQTRAINING_DFE_TIME_S2	0x3c
+#define QPHY_V6_PCS_USB3_RCVR_DTCT_DLY_U3_L		0x40
+#define QPHY_V6_PCS_USB3_RCVR_DTCT_DLY_U3_H		0x44
+
+#endif
drivers/phy/qcom/phy-qcom-qmp-pcs-usb-v7.h new file +17 -0
new file mode 100644
index 00000000000..24368d45ae7
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2023, Linaro Limited
+ */
+
+#ifndef QCOM_PHY_QMP_PCS_USB_V7_H_
+#define QCOM_PHY_QMP_PCS_USB_V7_H_
+
+#define QPHY_V7_PCS_USB3_POWER_STATE_CONFIG1		0x00
+#define QPHY_V7_PCS_USB3_AUTONOMOUS_MODE_CTRL		0x08
+#define QPHY_V7_PCS_USB3_LFPS_RXTERM_IRQ_CLEAR		0x14
+#define QPHY_V7_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL	0x18
+#define QPHY_V7_PCS_USB3_RXEQTRAINING_DFE_TIME_S2	0x3c
+#define QPHY_V7_PCS_USB3_RCVR_DTCT_DLY_U3_L		0x40
+#define QPHY_V7_PCS_USB3_RCVR_DTCT_DLY_U3_H		0x44
+
+#endif
drivers/phy/qcom/phy-qcom-qmp-pcs-usb-v8.h new file +38 -0
new file mode 100644
index 00000000000..89ace8024bc
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2025 Qualcomm Innovation Center, Inc. All rights reserved.
+ */
+
+#ifndef QCOM_PHY_QMP_PCS_USB_V8_H_
+#define QCOM_PHY_QMP_PCS_USB_V8_H_
+
+#define QPHY_V8_PCS_USB_POWER_STATE_CONFIG1		0x00
+#define QPHY_V8_PCS_USB_AUTONOMOUS_MODE_STATUS		0x04
+#define QPHY_V8_PCS_USB_AUTONOMOUS_MODE_CTRL		0x08
+#define QPHY_V8_PCS_USB_AUTONOMOUS_MODE_CTRL2		0x0c
+#define QPHY_V8_PCS_USB_LFPS_RXTERM_IRQ_SOURCE_STATUS	0x10
+#define QPHY_V8_PCS_USB_LFPS_RXTERM_IRQ_CLEAR		0x14
+#define QPHY_V8_PCS_USB_LFPS_DET_HIGH_COUNT_VAL		0x18
+#define QPHY_V8_PCS_USB_LFPS_TX_ECSTART			0x1c
+#define QPHY_V8_PCS_USB_LFPS_PER_TIMER_VAL		0x20
+#define QPHY_V8_PCS_USB_LFPS_TX_END_CNT_U3_START	0x24
+#define QPHY_V8_PCS_USB_LFPS_CONFIG1			0x28
+#define QPHY_V8_PCS_USB_RXEQTRAINING_LOCK_TIME		0x2c
+#define QPHY_V8_PCS_USB_RXEQTRAINING_WAIT_TIME		0x30
+#define QPHY_V8_PCS_USB_RXEQTRAINING_CTLE_TIME		0x34
+#define QPHY_V8_PCS_USB_RXEQTRAINING_WAIT_TIME_S2	0x38
+#define QPHY_V8_PCS_USB_RXEQTRAINING_DFE_TIME_S2	0x3c
+#define QPHY_V8_PCS_USB_RCVR_DTCT_DLY_U3_L		0x40
+#define QPHY_V8_PCS_USB_RCVR_DTCT_DLY_U3_H		0x44
+#define QPHY_V8_PCS_USB_ARCVR_DTCT_EN_PERIOD		0x48
+#define QPHY_V8_PCS_USB_ARCVR_DTCT_CM_DLY		0x4c
+#define QPHY_V8_PCS_USB_TXONESZEROS_RUN_LENGTH		0x50
+#define QPHY_V8_PCS_USB_ALFPS_DEGLITCH_VAL		0x54
+#define QPHY_V8_PCS_USB_SIGDET_STARTUP_TIMER_VAL	0x58
+#define QPHY_V8_PCS_USB_TEST_CONTROL			0x5c
+#define QPHY_V8_PCS_USB_RXTERMINATION_DLY_SEL		0x60
+#define QPHY_V8_PCS_USB_POWER_STATE_CONFIG2		0x64
+#define QPHY_V8_PCS_USB_POWER_STATE_CONFIG3		0x68
+#define QPHY_V8_PCS_USB_POWER_STATE_CONFIG4		0x6c
+
+#endif
drivers/phy/qcom/phy-qcom-qmp-pcs-v4_20.h new file +15 -0
new file mode 100644
index 00000000000..08c3dd11548
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ */
+
+#ifndef QCOM_PHY_QMP_PCS_V4_20_H_
+#define QCOM_PHY_QMP_PCS_V4_20_H_
+
+/* Only for QMP V4_20 PHY - USB/PCIe PCS registers */
+#define QPHY_V4_20_PCS_RX_SIGDET_LVL			0x188
+#define QPHY_V4_20_PCS_EQ_CONFIG2			0x1d8
+#define QPHY_V4_20_PCS_EQ_CONFIG4			0x1e0
+#define QPHY_V4_20_PCS_EQ_CONFIG5			0x1e4
+
+#endif
drivers/phy/qcom/phy-qcom-qmp-pcs-v5_20.h new file +21 -0
new file mode 100644
index 00000000000..bbee68df4e1
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2022, Linaro Ltd.
+ */
+
+#ifndef QCOM_PHY_QMP_PCS_V5_20_H_
+#define QCOM_PHY_QMP_PCS_V5_20_H_
+
+#define QPHY_V5_20_PCS_INSIG_SW_CTRL7			0x060
+#define QPHY_V5_20_PCS_INSIG_MX_CTRL7			0x07c
+#define QPHY_V5_20_PCS_LOCK_DETECT_CONFIG1		0x0c4
+#define QPHY_V5_20_PCS_LOCK_DETECT_CONFIG2		0x0c8
+#define QPHY_V5_20_PCS_G3S2_PRE_GAIN			0x170
+#define QPHY_V5_20_PCS_RX_SIGDET_LVL			0x188
+#define QPHY_V5_20_PCS_ALIGN_DETECT_CONFIG1		0x1b8
+#define QPHY_V5_20_PCS_ALIGN_DETECT_CONFIG2		0x1bc
+#define QPHY_V5_20_PCS_EQ_CONFIG2			0x1d8
+#define QPHY_V5_20_PCS_EQ_CONFIG4			0x1e0
+#define QPHY_V5_20_PCS_EQ_CONFIG5			0x1e4
+
+#endif
drivers/phy/qcom/phy-qcom-qmp-pcs-v6-n4.h new file +32 -0
new file mode 100644
index 00000000000..b3024714dab
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2023, Linaro Limited
+ */
+
+#ifndef QCOM_PHY_QMP_PCS_V6_N4_H_
+#define QCOM_PHY_QMP_PCS_V6_N4_H_
+
+/* Only for QMP V6 N4 PHY - USB/PCIe PCS registers */
+#define QPHY_V6_N4_PCS_SW_RESET			0x000
+#define QPHY_V6_N4_PCS_PCS_STATUS1		0x014
+#define QPHY_V6_N4_PCS_POWER_DOWN_CONTROL	0x040
+#define QPHY_V6_N4_PCS_START_CONTROL		0x044
+#define QPHY_V6_N4_PCS_POWER_STATE_CONFIG1	0x090
+#define QPHY_V6_N4_PCS_LOCK_DETECT_CONFIG1	0x0c4
+#define QPHY_V6_N4_PCS_LOCK_DETECT_CONFIG2	0x0c8
+#define QPHY_V6_N4_PCS_LOCK_DETECT_CONFIG3	0x0cc
+#define QPHY_V6_N4_PCS_LOCK_DETECT_CONFIG6	0x0d8
+#define QPHY_V6_N4_PCS_REFGEN_REQ_CONFIG1	0x0dc
+#define QPHY_V6_N4_PCS_RX_SIGDET_LVL		0x188
+#define QPHY_V6_N4_PCS_RCVR_DTCT_DLY_P1U2_L	0x190
+#define QPHY_V6_N4_PCS_RCVR_DTCT_DLY_P1U2_H	0x194
+#define QPHY_V6_N4_PCS_RATE_SLEW_CNTRL1		0x198
+#define QPHY_V6_N4_PCS_RX_CONFIG		0x1b0
+#define QPHY_V6_N4_PCS_ALIGN_DETECT_CONFIG1	0x1c0
+#define QPHY_V6_N4_PCS_ALIGN_DETECT_CONFIG2	0x1c4
+#define QPHY_V6_N4_PCS_PCS_TX_RX_CONFIG		0x1d0
+#define QPHY_V6_N4_PCS_EQ_CONFIG1		0x1dc
+#define QPHY_V6_N4_PCS_EQ_CONFIG2		0x1e0
+#define QPHY_V6_N4_PCS_EQ_CONFIG5		0x1ec
+
+#endif
drivers/phy/qcom/phy-qcom-qmp-pcs-v6.h +2 -0
index 08299d2b78f..aa5afb921f1 100644
@@ -17,6 +17,8 @@
 #define QPHY_V6_PCS_LOCK_DETECT_CONFIG3		0x0cc
 #define QPHY_V6_PCS_LOCK_DETECT_CONFIG6		0x0d8
 #define QPHY_V6_PCS_REFGEN_REQ_CONFIG1		0x0dc
+#define QPHY_V6_PCS_G12S1_TXDEEMPH_M6DB		0x168
+#define QPHY_V6_PCS_G3S2_PRE_GAIN		0x170
 #define QPHY_V6_PCS_RX_SIGDET_LVL		0x188
 #define QPHY_V6_PCS_RCVR_DTCT_DLY_P1U2_L	0x190
 #define QPHY_V6_PCS_RCVR_DTCT_DLY_P1U2_H	0x194
drivers/phy/qcom/phy-qcom-qmp-pcs-v7.h new file +34 -0
new file mode 100644
index 00000000000..4b7fcaa6a37
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2023, Linaro Limited
+ */
+
+#ifndef QCOM_PHY_QMP_PCS_V7_H_
+#define QCOM_PHY_QMP_PCS_V7_H_
+
+/* Only for QMP V7 PHY - USB/PCIe PCS registers */
+#define QPHY_V7_PCS_SW_RESET			0x000
+#define QPHY_V7_PCS_PCS_STATUS1			0x014
+#define QPHY_V7_PCS_POWER_DOWN_CONTROL		0x040
+#define QPHY_V7_PCS_START_CONTROL		0x044
+#define QPHY_V7_PCS_POWER_STATE_CONFIG1		0x090
+#define QPHY_V7_PCS_LOCK_DETECT_CONFIG1		0x0c4
+#define QPHY_V7_PCS_LOCK_DETECT_CONFIG2		0x0c8
+#define QPHY_V7_PCS_LOCK_DETECT_CONFIG3		0x0cc
+#define QPHY_V7_PCS_LOCK_DETECT_CONFIG6		0x0d8
+#define QPHY_V7_PCS_REFGEN_REQ_CONFIG1		0x0dc
+#define QPHY_V7_PCS_G12S1_TXDEEMPH_M6DB		0x168
+#define QPHY_V7_PCS_G3S2_PRE_GAIN		0x170
+#define QPHY_V7_PCS_RX_SIGDET_LVL		0x188
+#define QPHY_V7_PCS_RCVR_DTCT_DLY_P1U2_L	0x190
+#define QPHY_V7_PCS_RCVR_DTCT_DLY_P1U2_H	0x194
+#define QPHY_V7_PCS_RATE_SLEW_CNTRL1		0x198
+#define QPHY_V7_PCS_CDR_RESET_TIME		0x1b0
+#define QPHY_V7_PCS_ALIGN_DETECT_CONFIG1	0x1c0
+#define QPHY_V7_PCS_ALIGN_DETECT_CONFIG2	0x1c4
+#define QPHY_V7_PCS_PCS_TX_RX_CONFIG		0x1d0
+#define QPHY_V7_PCS_EQ_CONFIG1			0x1dc
+#define QPHY_V7_PCS_EQ_CONFIG2			0x1e0
+#define QPHY_V7_PCS_EQ_CONFIG5			0x1ec
+
+#endif
drivers/phy/qcom/phy-qcom-qmp-pcs-v8.h new file +32 -0
new file mode 100644
index 00000000000..169fd5de747
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2025 Qualcomm Innovation Center, Inc. All rights reserved.
+ */
+
+#ifndef QCOM_PHY_QMP_PCS_V8_H_
+#define QCOM_PHY_QMP_PCS_V8_H_
+
+/* Only for QMP V8 PHY - USB/PCIe PCS registers */
+#define QPHY_V8_PCS_SW_RESET			0x000
+#define QPHY_V8_PCS_PCS_STATUS1			0x014
+#define QPHY_V8_PCS_POWER_DOWN_CONTROL		0x040
+#define QPHY_V8_PCS_START_CONTROL		0x044
+#define QPHY_V8_PCS_POWER_STATE_CONFIG1		0x090
+#define QPHY_V8_PCS_LOCK_DETECT_CONFIG1		0x0c4
+#define QPHY_V8_PCS_LOCK_DETECT_CONFIG2		0x0c8
+#define QPHY_V8_PCS_LOCK_DETECT_CONFIG3		0x0cc
+#define QPHY_V8_PCS_LOCK_DETECT_CONFIG6		0x0d8
+#define QPHY_V8_PCS_REFGEN_REQ_CONFIG1		0x0dc
+#define QPHY_V8_PCS_RX_SIGDET_LVL		0x188
+#define QPHY_V8_PCS_RCVR_DTCT_DLY_P1U2_L	0x190
+#define QPHY_V8_PCS_RCVR_DTCT_DLY_P1U2_H	0x194
+#define QPHY_V8_PCS_RATE_SLEW_CNTRL1		0x198
+#define QPHY_V8_PCS_CDR_RESET_TIME		0x1b0
+#define QPHY_V8_PCS_ALIGN_DETECT_CONFIG1	0x1c0
+#define QPHY_V8_PCS_ALIGN_DETECT_CONFIG2	0x1c4
+#define QPHY_V8_PCS_PCS_TX_RX_CONFIG		0x1d0
+#define QPHY_V8_PCS_EQ_CONFIG1			0x1dc
+#define QPHY_V8_PCS_EQ_CONFIG2			0x1e0
+#define QPHY_V8_PCS_EQ_CONFIG5			0x1ec
+
+#endif
drivers/phy/qcom/phy-qcom-qmp-pcs-v8_50.h new file +13 -0
new file mode 100644
index 00000000000..325c127e8eb
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+#ifndef QCOM_PHY_QMP_PCS_V8_50_H_
+#define QCOM_PHY_QMP_PCS_V8_50_H_
+
+#define QPHY_V8_50_PCS_STATUS1			0x010
+#define QPHY_V8_50_PCS_START_CONTROL			0x05c
+#define QPHY_V8_50_PCS_POWER_DOWN_CONTROL			0x64
+
+#endif
drivers/phy/qcom/phy-qcom-qmp-qserdes-com-v2.h new file +109 -0

109 lines not on this page · raw message

drivers/phy/qcom/phy-qcom-qmp-qserdes-com-v6.h +7 -0
index 328c6c0b0b0..258f3d30742 100644
@@ -86,4 +86,11 @@
 #define QSERDES_V6_COM_CMN_STATUS				0x1d0
 #define QSERDES_V6_COM_C_READY_STATUS				0x1f8
 
+#define QSERDES_V6_COM_ADAPTIVE_ANALOG_CONFIG			0x268
+#define QSERDES_V6_COM_CP_CTRL_ADAPTIVE_MODE0			0x26c
+#define QSERDES_V6_COM_PLL_RCCTRL_ADAPTIVE_MODE0		0x270
+#define QSERDES_V6_COM_PLL_CCTRL_ADAPTIVE_MODE0			0x274
+#define QSERDES_V6_COM_CP_CTRL_ADAPTIVE_MODE1			0x278
+#define QSERDES_V6_COM_PLL_RCCTRL_ADAPTIVE_MODE1		0x27c
+#define QSERDES_V6_COM_PLL_CCTRL_ADAPTIVE_MODE1			0x280
 #endif
drivers/phy/qcom/phy-qcom-qmp-qserdes-com-v7.h new file +87 -0

87 lines not on this page · raw message

drivers/phy/qcom/phy-qcom-qmp-qserdes-com-v8.h new file +75 -0

75 lines not on this page · raw message

drivers/phy/qcom/phy-qcom-qmp-qserdes-com.h +100 -131

238 lines not on this page · raw message

drivers/phy/qcom/phy-qcom-qmp-qserdes-lalb-v8.h new file +639 -0

639 lines not on this page · raw message

drivers/phy/qcom/phy-qcom-qmp-qserdes-ln-shrd-v5.h new file +11 -0
new file mode 100644
index 00000000000..68c38fdfc1d
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2025, The Linux Foundation. All rights reserved.
+ */
+
+#ifndef QCOM_PHY_QMP_QSERDES_LN_SHRD_V5_H_
+#define QCOM_PHY_QMP_QSERDES_LN_SHRD_V5_H_
+
+#define  QSERDES_v5_LN_SHRD_UCDR_PI_CTRL2		0x04c
+
+#endif
drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v2.h new file +205 -0

205 lines not on this page · raw message

drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v4_20.h new file +43 -0

43 lines not on this page · raw message

drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v5_20.h new file +86 -0

86 lines not on this page · raw message

drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v5_5nm.h new file +328 -0

328 lines not on this page · raw message

drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v6.h +1 -0
index 23ffcfae9ef..f47fdc9cecd 100644
@@ -6,6 +6,7 @@
 #ifndef QCOM_PHY_QMP_QSERDES_TXRX_USB_V6_H_
 #define QCOM_PHY_QMP_QSERDES_TXRX_USB_V6_H_
 
+#define QSERDES_V6_TX_BIST_MODE_LANENO				0x00
 #define QSERDES_V6_TX_CLKBUF_ENABLE				0x08
 #define QSERDES_V6_TX_TX_EMP_POST1_LVL				0x0c
 #define QSERDES_V6_TX_TX_DRV_LVL				0x14
drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v6_n4.h new file +64 -0

64 lines not on this page · raw message

drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v7.h new file +80 -0

80 lines not on this page · raw message

drivers/phy/qcom/phy-qcom-qmp-qserdes-txrx-v8.h new file +68 -0

68 lines not on this page · raw message

drivers/phy/qcom/phy-qcom-qmp-ufs.c +68 -68

151 lines not on this page · raw message

drivers/phy/qcom/phy-qcom-qmp-usb.c new file +2198 -0

497 lines not on this page · raw message

drivers/phy/qcom/phy-qcom-qmp-usb43-qserdes-com-v8.h new file +224 -0

224 lines not on this page · raw message

drivers/phy/qcom/phy-qcom-qmp.h +50 -92

142 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.34.1

Part of the diff is not shown here. View the raw message.

#4 lore raw

PATCH 4/5 configs: ipq9574: Enable fastboot support

In reply to Varadarajan Narayanan via U-Boot

Enable relevant configs like USB PHY, gadget, fastboot, fastboot MMC support etc. to enable fastboot flashing of IPQ9574 based boards.

---
 configs/qcom_ipq9574_mmc_defconfig | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
configs/qcom_ipq9574_mmc_defconfig +17 -1
index d1da6bc82c8..a5def1b9a7c 100644
@@ -44,7 +44,7 @@ CONFIG_DWC_ETH_QOS=y
 CONFIG_DWC_ETH_QOS_QCOM=y
 CONFIG_RGMII=y
 CONFIG_PHY=y
-CONFIG_PHY_QCOM_QMP_UFS=y
+CONFIG_PHY_QCOM_QMP_USB=y
 CONFIG_PHY_QCOM_QUSB2=y
 CONFIG_PINCTRL=y
 CONFIG_PINCONF=y
@@ -53,3 +53,19 @@ CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_MSM_SERIAL=y
 CONFIG_MSM_GENI_SERIAL=y
 CONFIG_SOC_QCOM=y
+CONFIG_USB=y
+CONFIG_USB_GADGET=y
+CONFIG_DM_USB_GADGET=y
+CONFIG_CMD_USB=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3_GADGET=y
+CONFIG_MISC=y
+CONFIG_USB_DWC3_GENERIC=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT=y
+CONFIG_CMD_FASTBOOT=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_BUF_ADDR=0x50000000
+CONFIG_FASTBOOT_BUF_SIZE=0x4000000
Signature · 1 line
2.34.1
#5 lore raw

PATCH 5/5 doc: board/qualcomm: Update RDP flashing instructions

In reply to Varadarajan Narayanan via U-Boot

Update the flashing instructions to include fastboot.

---
 doc/board/qualcomm/rdp.rst | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
doc/board/qualcomm/rdp.rst +16 -0
index 99cf8eba57c..fb3fde7c381 100644
@@ -42,6 +42,22 @@ on your device with::
 
 U-Boot should be running after a reboot (``reset``).
 
+This board is capable of network connectivity over ethernet. However, the
+relevant network driver is not available yet for U-Boot.  To restore the
+original U-Boot or flash modified versions of the above built U-Boot, 'fastboot'
+can be used.
+
+  => setenv serial# ipq9574
+  => fastboot usb 0
+
+  C:\>.\fastboot.exe devices
+  ipq9574  fastboot
+
+  C:\>.\fastboot flash 0:APPSBL u-boot.mbn
+  Sending '0:APPSBL' (620 KB)                        OKAY [  0.042s]
+  Writing '0:APPSBL'                                 OKAY [  0.030s]
+  Finished. Total time: 0.342s
+
 .. WARNING
 	Boards with newer software versions would automatically go the emergency
 	download (EDL) mode if U-Boot is not functioning as expected. If its a
Signature · 1 line
2.34.1