stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] PCI: rcar: Fix missing MACCTLR register setting in" failed to apply to 4.19-stable tree
@ 2019-12-19  9:03 gregkh
  2019-12-20  0:33 ` Nobuhiro Iwamatsu
  0 siblings, 1 reply; 2+ messages in thread
From: gregkh @ 2019-12-19  9:03 UTC (permalink / raw)
  To: yoshihiro.shimoda.uh, erosca, geert+renesas, lorenzo.pieralisi,
	stable
  Cc: stable


The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 7c7e53e1c93df14690bd12c1f84730fef927a6f1 Mon Sep 17 00:00:00 2001
From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Date: Tue, 5 Nov 2019 19:51:29 +0900
Subject: [PATCH] PCI: rcar: Fix missing MACCTLR register setting in
 initialization sequence

The R-Car Gen2/3 manual - available at:

https://www.renesas.com/eu/en/products/microcontrollers-microprocessors/rz/rzg/rzg1m.html#documents

"RZ/G Series User's Manual: Hardware" section

strictly enforces the MACCTLR inizialization value - 39.3.1 - "Initial
Setting of PCI Express":

"Be sure to write the initial value (= H'80FF 0000) to MACCTLR before
enabling PCIETCTLR.CFINIT".

To avoid unexpected behavior and to match the SW initialization sequence
guidelines, this patch programs the MACCTLR with the correct value.

Note that the MACCTLR.SPCHG bit in the MACCTLR register description
reports that "Only writing 1 is valid and writing 0 is invalid" but this
"invalid" has to be interpreted as a write-ignore aka "ignored", not
"prohibited".

Reported-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Fixes: c25da4778803 ("PCI: rcar: Add Renesas R-Car PCIe driver")
Fixes: be20bbcb0a8c ("PCI: rcar: Add the initialization of PCIe link in resume_noirq()")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: <stable@vger.kernel.org> # v5.2+

diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c
index 40d8c54a17d1..94ba4fe21923 100644
--- a/drivers/pci/controller/pcie-rcar.c
+++ b/drivers/pci/controller/pcie-rcar.c
@@ -91,8 +91,11 @@
 #define  LINK_SPEED_2_5GTS	(1 << 16)
 #define  LINK_SPEED_5_0GTS	(2 << 16)
 #define MACCTLR			0x011058
+#define  MACCTLR_NFTS_MASK	GENMASK(23, 16)	/* The name is from SH7786 */
 #define  SPEED_CHANGE		BIT(24)
 #define  SCRAMBLE_DISABLE	BIT(27)
+#define  LTSMDIS		BIT(31)
+#define  MACCTLR_INIT_VAL	(LTSMDIS | MACCTLR_NFTS_MASK)
 #define PMSR			0x01105c
 #define MACS2R			0x011078
 #define MACCGSPSETR		0x011084
@@ -613,6 +616,8 @@ static int rcar_pcie_hw_init(struct rcar_pcie *pcie)
 	if (IS_ENABLED(CONFIG_PCI_MSI))
 		rcar_pci_write_reg(pcie, 0x801f0000, PCIEMSITXR);
 
+	rcar_pci_write_reg(pcie, MACCTLR_INIT_VAL, MACCTLR);
+
 	/* Finish initialization - establish a PCI Express link */
 	rcar_pci_write_reg(pcie, CFINIT, PCIETCTLR);
 
@@ -1235,6 +1240,7 @@ static int rcar_pcie_resume_noirq(struct device *dev)
 		return 0;
 
 	/* Re-establish the PCIe link */
+	rcar_pci_write_reg(pcie, MACCTLR_INIT_VAL, MACCTLR);
 	rcar_pci_write_reg(pcie, CFINIT, PCIETCTLR);
 	return rcar_pcie_wait_for_dl(pcie);
 }


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: FAILED: patch "[PATCH] PCI: rcar: Fix missing MACCTLR register setting in" failed to apply to 4.19-stable tree
  2019-12-19  9:03 FAILED: patch "[PATCH] PCI: rcar: Fix missing MACCTLR register setting in" failed to apply to 4.19-stable tree gregkh
@ 2019-12-20  0:33 ` Nobuhiro Iwamatsu
  0 siblings, 0 replies; 2+ messages in thread
From: Nobuhiro Iwamatsu @ 2019-12-20  0:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Yoshihiro Shimoda, erosca, geert+renesas, Lorenzo Pieralisi,
	stable

Hi,

2019年12月19日(木) 18:03 <gregkh@linuxfoundation.org>:
>
>
> The patch below does not apply to the 4.19-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.
>
> thanks,
>
> greg k-h

This is already applied to 4.19.y tree.
    https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.19.y&id=2de11b2e5dd2dce4f0f44101bb7aadb49e13de41

Best regards,
  Nobuhiro

>
> ------------------ original commit in Linus's tree ------------------
>
> From 7c7e53e1c93df14690bd12c1f84730fef927a6f1 Mon Sep 17 00:00:00 2001
> From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> Date: Tue, 5 Nov 2019 19:51:29 +0900
> Subject: [PATCH] PCI: rcar: Fix missing MACCTLR register setting in
>  initialization sequence
>
> The R-Car Gen2/3 manual - available at:
>
> https://www.renesas.com/eu/en/products/microcontrollers-microprocessors/rz/rzg/rzg1m.html#documents
>
> "RZ/G Series User's Manual: Hardware" section
>
> strictly enforces the MACCTLR inizialization value - 39.3.1 - "Initial
> Setting of PCI Express":
>
> "Be sure to write the initial value (= H'80FF 0000) to MACCTLR before
> enabling PCIETCTLR.CFINIT".
>
> To avoid unexpected behavior and to match the SW initialization sequence
> guidelines, this patch programs the MACCTLR with the correct value.
>
> Note that the MACCTLR.SPCHG bit in the MACCTLR register description
> reports that "Only writing 1 is valid and writing 0 is invalid" but this
> "invalid" has to be interpreted as a write-ignore aka "ignored", not
> "prohibited".
>
> Reported-by: Eugeniu Rosca <erosca@de.adit-jv.com>
> Fixes: c25da4778803 ("PCI: rcar: Add Renesas R-Car PCIe driver")
> Fixes: be20bbcb0a8c ("PCI: rcar: Add the initialization of PCIe link in resume_noirq()")
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: <stable@vger.kernel.org> # v5.2+
>
> diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c
> index 40d8c54a17d1..94ba4fe21923 100644
> --- a/drivers/pci/controller/pcie-rcar.c
> +++ b/drivers/pci/controller/pcie-rcar.c
> @@ -91,8 +91,11 @@
>  #define  LINK_SPEED_2_5GTS     (1 << 16)
>  #define  LINK_SPEED_5_0GTS     (2 << 16)
>  #define MACCTLR                        0x011058
> +#define  MACCTLR_NFTS_MASK     GENMASK(23, 16) /* The name is from SH7786 */
>  #define  SPEED_CHANGE          BIT(24)
>  #define  SCRAMBLE_DISABLE      BIT(27)
> +#define  LTSMDIS               BIT(31)
> +#define  MACCTLR_INIT_VAL      (LTSMDIS | MACCTLR_NFTS_MASK)
>  #define PMSR                   0x01105c
>  #define MACS2R                 0x011078
>  #define MACCGSPSETR            0x011084
> @@ -613,6 +616,8 @@ static int rcar_pcie_hw_init(struct rcar_pcie *pcie)
>         if (IS_ENABLED(CONFIG_PCI_MSI))
>                 rcar_pci_write_reg(pcie, 0x801f0000, PCIEMSITXR);
>
> +       rcar_pci_write_reg(pcie, MACCTLR_INIT_VAL, MACCTLR);
> +
>         /* Finish initialization - establish a PCI Express link */
>         rcar_pci_write_reg(pcie, CFINIT, PCIETCTLR);
>
> @@ -1235,6 +1240,7 @@ static int rcar_pcie_resume_noirq(struct device *dev)
>                 return 0;
>
>         /* Re-establish the PCIe link */
> +       rcar_pci_write_reg(pcie, MACCTLR_INIT_VAL, MACCTLR);
>         rcar_pci_write_reg(pcie, CFINIT, PCIETCTLR);
>         return rcar_pcie_wait_for_dl(pcie);
>  }
>


-- 
Nobuhiro Iwamatsu
   iwamatsu at {nigauri.org / debian.org}
   GPG ID: 40AD1FA6

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-20  0:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-19  9:03 FAILED: patch "[PATCH] PCI: rcar: Fix missing MACCTLR register setting in" failed to apply to 4.19-stable tree gregkh
2019-12-20  0:33 ` Nobuhiro Iwamatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).