Skip to content

Commit 9ffc904

Browse files
author
Richard Zhu
committed
MLK-25349-3 PCI: imx: clear vreg bypass when pcie vph voltage is 3v3
Both 1.8v and 3.3v power supplies can be used by i.MX8MQ PCIe PHY. In default, the PCIE_VPH voltage is suggested to be 1.8v refer to data sheet. When PCIE_VPH is supplied by 3.3v in the HW schematic design, the VREG_BYPASS bits of GPR registers should be cleared from default value 1b'1 to 1b'0. Thus, the internal 3v3 to 1v8 translator would be turned on. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> Reviewed-by: Jun Li <jun.li@nxp.com> (cherry picked from commit 94e84f467b688ce79eb3239f1516f6009b75a19b)
1 parent 6430191 commit 9ffc904

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

drivers/pci/controller/dwc/pci-imx6.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#define IMX8MQ_GPR_PCIE_REF_USE_PAD BIT(9)
4747
#define IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN BIT(10)
4848
#define IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE BIT(11)
49+
#define IMX8MQ_GPR_PCIE_VREG_BYPASS BIT(12)
4950
#define IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE GENMASK(11, 8)
5051
#define IMX8MQ_PCIE2_BASE_ADDR 0x33c00000
5152
#define IMX8_HSIO_PCIEB_BASE_ADDR 0x5f010000
@@ -144,6 +145,7 @@ struct imx6_pcie {
144145
u32 l1ss_clkreq;
145146
int link_gen;
146147
struct regulator *vpcie;
148+
struct regulator *vph;
147149
void __iomem *phy_base;
148150
void __iomem *hsmix_base;
149151

@@ -1596,6 +1598,17 @@ static void imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie)
15961598
imx6_pcie_grp_offset(imx6_pcie),
15971599
IMX8MQ_GPR_PCIE_REF_USE_PAD,
15981600
IMX8MQ_GPR_PCIE_REF_USE_PAD);
1601+
/*
1602+
* Regarding to the datasheet, the PCIE_VPH is suggested
1603+
* to be 1.8V. If the PCIE_VPH is supplied by 3.3V, the
1604+
* VREG_BYPASS should be cleared to zero.
1605+
*/
1606+
if (imx6_pcie->vph &&
1607+
regulator_get_voltage(imx6_pcie->vph) > 3000000)
1608+
regmap_update_bits(imx6_pcie->iomuxc_gpr,
1609+
imx6_pcie_grp_offset(imx6_pcie),
1610+
IMX8MQ_GPR_PCIE_VREG_BYPASS,
1611+
0);
15991612
break;
16001613
case IMX8MP:
16011614
case IMX8MP_EP:
@@ -2685,6 +2698,13 @@ static int imx6_pcie_probe(struct platform_device *pdev)
26852698
imx6_pcie->vpcie = NULL;
26862699
}
26872700

2701+
imx6_pcie->vph = devm_regulator_get_optional(&pdev->dev, "vph");
2702+
if (IS_ERR(imx6_pcie->vph)) {
2703+
if (PTR_ERR(imx6_pcie->vph) != -ENODEV)
2704+
return PTR_ERR(imx6_pcie->vph);
2705+
imx6_pcie->vph = NULL;
2706+
}
2707+
26882708
platform_set_drvdata(pdev, imx6_pcie);
26892709

26902710
ret = imx6_pcie_attach_pd(dev);

0 commit comments

Comments
 (0)