Skip to content

Commit 47f54a9

Browse files
Richard ZhuMani-Sadhasivam
authored andcommitted
PCI: imx6: Toggle the core reset for i.MX95 PCIe
Add toggling core reset for i.MX95 to align with PHY's power-up sequence. Note that the register is named as IMX95_PCIE_COLD_RST in hardware, though it is used to reset the PCIe core. Signed-off-by: Richard Zhu <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> [mani: subject and description rewording] Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Frank Li <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 4a4be0c commit 47f54a9

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

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

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@
7171
#define IMX95_SID_MASK GENMASK(5, 0)
7272
#define IMX95_MAX_LUT 32
7373

74+
#define IMX95_PCIE_RST_CTRL 0x3010
75+
#define IMX95_PCIE_COLD_RST BIT(0)
76+
7477
#define to_imx_pcie(x) dev_get_drvdata((x)->dev)
7578

7679
enum imx_pcie_variants {
@@ -773,6 +776,43 @@ static int imx7d_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert)
773776
return 0;
774777
}
775778

779+
static int imx95_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert)
780+
{
781+
u32 val;
782+
783+
if (assert) {
784+
/*
785+
* From i.MX95 PCIe PHY perspective, the COLD reset toggle
786+
* should be complete after power-up by the following sequence.
787+
* > 10us(at power-up)
788+
* > 10ns(warm reset)
789+
* |<------------>|
790+
* ______________
791+
* phy_reset ____/ \________________
792+
* ____________
793+
* ref_clk_en_______________________/
794+
* Toggle COLD reset aligned with this sequence for i.MX95 PCIe.
795+
*/
796+
regmap_set_bits(imx_pcie->iomuxc_gpr, IMX95_PCIE_RST_CTRL,
797+
IMX95_PCIE_COLD_RST);
798+
/*
799+
* Make sure the write to IMX95_PCIE_RST_CTRL is flushed to the
800+
* hardware by doing a read. Otherwise, there is no guarantee
801+
* that the write has reached the hardware before udelay().
802+
*/
803+
regmap_read_bypassed(imx_pcie->iomuxc_gpr, IMX95_PCIE_RST_CTRL,
804+
&val);
805+
udelay(15);
806+
regmap_clear_bits(imx_pcie->iomuxc_gpr, IMX95_PCIE_RST_CTRL,
807+
IMX95_PCIE_COLD_RST);
808+
regmap_read_bypassed(imx_pcie->iomuxc_gpr, IMX95_PCIE_RST_CTRL,
809+
&val);
810+
udelay(10);
811+
}
812+
813+
return 0;
814+
}
815+
776816
static void imx_pcie_assert_core_reset(struct imx_pcie *imx_pcie)
777817
{
778818
reset_control_assert(imx_pcie->pciephy_reset);
@@ -1739,6 +1779,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
17391779
.ltssm_mask = IMX95_PCIE_LTSSM_EN,
17401780
.mode_off[0] = IMX95_PE0_GEN_CTRL_1,
17411781
.mode_mask[0] = IMX95_PCIE_DEVICE_TYPE,
1782+
.core_reset = imx95_pcie_core_reset,
17421783
.init_phy = imx95_pcie_init_phy,
17431784
},
17441785
[IMX8MQ_EP] = {
@@ -1792,6 +1833,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
17921833
.mode_off[0] = IMX95_PE0_GEN_CTRL_1,
17931834
.mode_mask[0] = IMX95_PCIE_DEVICE_TYPE,
17941835
.init_phy = imx95_pcie_init_phy,
1836+
.core_reset = imx95_pcie_core_reset,
17951837
.epc_features = &imx95_pcie_epc_features,
17961838
.mode = DW_PCIE_EP_TYPE,
17971839
},

0 commit comments

Comments
 (0)