* [PATCH] imx6 PCI Host initialisation order
@ 2014-09-08 9:10 Raymond van der Rots
2014-09-08 11:28 ` Shawn Guo
0 siblings, 1 reply; 4+ messages in thread
From: Raymond van der Rots @ 2014-09-08 9:10 UTC (permalink / raw)
To: r65037, shawn.guo; +Cc: linux-kernel
Hi,
The imx6dl on our hardware board frequently had problems bringing up the PCI link, with or without peripherals connected. I found these issues to be due to the initialisation order of the PCI Host.
The host driver first enables the phy, and then enables its clocks. However, according to the reference manual (IMX6SDLRM, page 2033):
> The phy_ref_ssp_en signal must remain deasserted until the reference clock is running at the appropriate frequency, at which point phy_ref_ssp_en can be asserted.
Which implies that the clocks should be brought up first, after which the peripheral should be enabled.
This patch changes that initialisation order.
I do not have other hardware with an imx6dl, so this patch has only been tested on our board. Could someone confirm that this is more technically correct or improves behaviour?
Signed-off-by: Raymond van der Rots <raymond@electrocompaniet.no>
---
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
index a568efa..17c35b4 100644
--- a/drivers/pci/host/pci-imx6.c
+++ b/drivers/pci/host/pci-imx6.c
@@ -228,11 +228,6 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);
int ret;
- regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
- IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
- regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
- IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
-
ret = clk_prepare_enable(imx6_pcie->pcie_phy);
if (ret) {
dev_err(pp->dev, "unable to enable pcie_phy clock\n");
@@ -254,6 +249,11 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
/* allow the clocks to stabilize */
usleep_range(200, 500);
+ regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
+ IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
+ regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
+ IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
+
/* Some boards don't have PCIe reset GPIO. */
if (gpio_is_valid(imx6_pcie->reset_gpio)) {
gpio_set_value(imx6_pcie->reset_gpio, 0);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] imx6 PCI Host initialisation order
2014-09-08 9:10 [PATCH] imx6 PCI Host initialisation order Raymond van der Rots
@ 2014-09-08 11:28 ` Shawn Guo
2014-09-08 16:51 ` Bjorn Helgaas
0 siblings, 1 reply; 4+ messages in thread
From: Shawn Guo @ 2014-09-08 11:28 UTC (permalink / raw)
To: Raymond van der Rots
Cc: r65037, linux-kernel, Lucas Stach, Tim Harvey, bhelgaas
Hi Raymond,
It seems that there is already a similar patch [1] from Tim floating
on the list.
Shawn
[1] http://www.spinics.net/lists/linux-pci/msg33520.html
On Mon, Sep 08, 2014 at 11:10:37AM +0200, Raymond van der Rots wrote:
> Hi,
>
> The imx6dl on our hardware board frequently had problems bringing up the PCI link, with or without peripherals connected. I found these issues to be due to the initialisation order of the PCI Host.
>
> The host driver first enables the phy, and then enables its clocks. However, according to the reference manual (IMX6SDLRM, page 2033):
> > The phy_ref_ssp_en signal must remain deasserted until the reference clock is running at the appropriate frequency, at which point phy_ref_ssp_en can be asserted.
>
>
> Which implies that the clocks should be brought up first, after which the peripheral should be enabled.
> This patch changes that initialisation order.
>
> I do not have other hardware with an imx6dl, so this patch has only been tested on our board. Could someone confirm that this is more technically correct or improves behaviour?
>
> Signed-off-by: Raymond van der Rots <raymond@electrocompaniet.no>
> ---
> diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
> index a568efa..17c35b4 100644
> --- a/drivers/pci/host/pci-imx6.c
> +++ b/drivers/pci/host/pci-imx6.c
> @@ -228,11 +228,6 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
> struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);
> int ret;
>
> - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
> - IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
> - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
> - IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
> -
> ret = clk_prepare_enable(imx6_pcie->pcie_phy);
> if (ret) {
> dev_err(pp->dev, "unable to enable pcie_phy clock\n");
> @@ -254,6 +249,11 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
> /* allow the clocks to stabilize */
> usleep_range(200, 500);
>
> + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
> + IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
> + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
> + IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
> +
> /* Some boards don't have PCIe reset GPIO. */
> if (gpio_is_valid(imx6_pcie->reset_gpio)) {
> gpio_set_value(imx6_pcie->reset_gpio, 0);
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] imx6 PCI Host initialisation order
2014-09-08 11:28 ` Shawn Guo
@ 2014-09-08 16:51 ` Bjorn Helgaas
2014-09-09 2:47 ` Hong-Xing.Zhu
0 siblings, 1 reply; 4+ messages in thread
From: Bjorn Helgaas @ 2014-09-08 16:51 UTC (permalink / raw)
To: Shawn Guo
Cc: Raymond van der Rots, Zhu Richard-R65037,
linux-kernel@vger.kernel.org, Lucas Stach, Tim Harvey
On Mon, Sep 8, 2014 at 5:28 AM, Shawn Guo <shawn.guo@freescale.com> wrote:
> Hi Raymond,
>
> It seems that there is already a similar patch [1] from Tim floating
> on the list.
>
> Shawn
>
> [1] http://www.spinics.net/lists/linux-pci/msg33520.html
Yes. MAINTAINERS lists Richard Zhu <r65037@freescale.com> and Shawn
Guo <shawn.guo@freescale.com> (hi Shawn :)) as the caretakers for
pci-imx6.c. Neither has acked it yet, and Richard asked for a comment
update, which I haven't seen yet. So I haven't applied it yet.
> On Mon, Sep 08, 2014 at 11:10:37AM +0200, Raymond van der Rots wrote:
>> Hi,
>>
>> The imx6dl on our hardware board frequently had problems bringing up the PCI link, with or without peripherals connected. I found these issues to be due to the initialisation order of the PCI Host.
>>
>> The host driver first enables the phy, and then enables its clocks. However, according to the reference manual (IMX6SDLRM, page 2033):
>> > The phy_ref_ssp_en signal must remain deasserted until the reference clock is running at the appropriate frequency, at which point phy_ref_ssp_en can be asserted.
>>
>>
>> Which implies that the clocks should be brought up first, after which the peripheral should be enabled.
>> This patch changes that initialisation order.
>>
>> I do not have other hardware with an imx6dl, so this patch has only been tested on our board. Could someone confirm that this is more technically correct or improves behaviour?
>>
>> Signed-off-by: Raymond van der Rots <raymond@electrocompaniet.no>
>> ---
>> diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
>> index a568efa..17c35b4 100644
>> --- a/drivers/pci/host/pci-imx6.c
>> +++ b/drivers/pci/host/pci-imx6.c
>> @@ -228,11 +228,6 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
>> struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);
>> int ret;
>>
>> - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
>> - IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
>> - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
>> - IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
>> -
>> ret = clk_prepare_enable(imx6_pcie->pcie_phy);
>> if (ret) {
>> dev_err(pp->dev, "unable to enable pcie_phy clock\n");
>> @@ -254,6 +249,11 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
>> /* allow the clocks to stabilize */
>> usleep_range(200, 500);
>>
>> + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
>> + IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
>> + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
>> + IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
>> +
>> /* Some boards don't have PCIe reset GPIO. */
>> if (gpio_is_valid(imx6_pcie->reset_gpio)) {
>> gpio_set_value(imx6_pcie->reset_gpio, 0);
>>
>>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] imx6 PCI Host initialisation order
2014-09-08 16:51 ` Bjorn Helgaas
@ 2014-09-09 2:47 ` Hong-Xing.Zhu
0 siblings, 0 replies; 4+ messages in thread
From: Hong-Xing.Zhu @ 2014-09-09 2:47 UTC (permalink / raw)
To: Bjorn Helgaas, Shawn Guo
Cc: Raymond van der Rots, linux-kernel@vger.kernel.org, Lucas Stach,
Tim Harvey
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 3631 bytes --]
> -----Original Message-----
> From: Bjorn Helgaas [mailto:bhelgaas@google.com]
> Sent: Tuesday, September 09, 2014 12:51 AM
> To: Guo Shawn-R65073
> Cc: Raymond van der Rots; Zhu Richard-R65037; linux-kernel@vger.kernel.org;
> Lucas Stach; Tim Harvey
> Subject: Re: [PATCH] imx6 PCI Host initialisation order
>
> On Mon, Sep 8, 2014 at 5:28 AM, Shawn Guo <shawn.guo@freescale.com> wrote:
> > Hi Raymond,
> >
> > It seems that there is already a similar patch [1] from Tim floating
> > on the list.
> >
> > Shawn
> >
> > [1] http://www.spinics.net/lists/linux-pci/msg33520.html
>
> Yes. MAINTAINERS lists Richard Zhu <r65037@freescale.com> and Shawn Guo
> <shawn.guo@freescale.com> (hi Shawn :)) as the caretakers for pci-imx6.c.
> Neither has acked it yet, and Richard asked for a comment update, which I
> haven't seen yet. So I haven't applied it yet.
>
[Richard] Yes it is. I recommended to add one comment used to describe why
the modification is required.
> > On Mon, Sep 08, 2014 at 11:10:37AM +0200, Raymond van der Rots wrote:
> >> Hi,
> >>
> >> The imx6dl on our hardware board frequently had problems bringing up the
> PCI link, with or without peripherals connected. I found these issues to be
> due to the initialisation order of the PCI Host.
> >>
> >> The host driver first enables the phy, and then enables its clocks. However,
> according to the reference manual (IMX6SDLRM, page 2033):
> >> > The phy_ref_ssp_en signal must remain deasserted until the reference
> clock is running at the appropriate frequency, at which point phy_ref_ssp_en
> can be asserted.
> >>
> >>
> >> Which implies that the clocks should be brought up first, after which the
> peripheral should be enabled.
> >> This patch changes that initialisation order.
> >>
> >> I do not have other hardware with an imx6dl, so this patch has only been
> tested on our board. Could someone confirm that this is more technically
> correct or improves behaviour?
> >>
> >> Signed-off-by: Raymond van der Rots <raymond@electrocompaniet.no>
> >> ---
> >> diff --git a/drivers/pci/host/pci-imx6.c
> >> b/drivers/pci/host/pci-imx6.c index a568efa..17c35b4 100644
> >> --- a/drivers/pci/host/pci-imx6.c
> >> +++ b/drivers/pci/host/pci-imx6.c
> >> @@ -228,11 +228,6 @@ static int imx6_pcie_deassert_core_reset(struct
> pcie_port *pp)
> >> struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);
> >> int ret;
> >>
> >> - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
> >> - IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
> >> - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
> >> - IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
> >> -
> >> ret = clk_prepare_enable(imx6_pcie->pcie_phy);
> >> if (ret) {
> >> dev_err(pp->dev, "unable to enable pcie_phy clock\n");
> >> @@ -254,6 +249,11 @@ static int imx6_pcie_deassert_core_reset(struct
> pcie_port *pp)
> >> /* allow the clocks to stabilize */
> >> usleep_range(200, 500);
> >>
> >> + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
> >> + IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
> >> + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
> >> + IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
> >> +
> >> /* Some boards don't have PCIe reset GPIO. */
> >> if (gpio_is_valid(imx6_pcie->reset_gpio)) {
> >> gpio_set_value(imx6_pcie->reset_gpio, 0);
> >>
> >>
Best Regards
Richard Zhu
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-09-09 3:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-08 9:10 [PATCH] imx6 PCI Host initialisation order Raymond van der Rots
2014-09-08 11:28 ` Shawn Guo
2014-09-08 16:51 ` Bjorn Helgaas
2014-09-09 2:47 ` Hong-Xing.Zhu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox