All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH u-boot-pci] pci: iproc: Set all 24 bits of PCI class code
@ 2022-01-05  9:50 Pali Rohár
  2022-01-05 16:55 ` Roman Bacik
  2022-01-25 15:58 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Pali Rohár @ 2022-01-05  9:50 UTC (permalink / raw)
  To: Roman Bacik, Bharat Gooty, Simon Glass, Stefan Roese; +Cc: u-boot

Register 0x43c in its low 24 bits contains PCI class code.

Update code to set all 24 bits of PCI class code and not only upper 16 bits
of PCI class code.

Use standard U-Boot macro (PCI_CLASS_BRIDGE_PCI << 8) for constructing all
24-bits of PCI class for PCI bridge Normal decode.

Signed-off-by: Pali Rohár <pali@kernel.org>

---
Roman helped me with this change and confirmed that class code is stored
really in bits [23:0] of custom register 0x43c (normally class code is
stored in bits [31:8] of pci register 0x08).
---
 drivers/pci/pcie_iproc.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/pcie_iproc.c b/drivers/pci/pcie_iproc.c
index be03dcbd97c0..fe68e417ae80 100644
--- a/drivers/pci/pcie_iproc.c
+++ b/drivers/pci/pcie_iproc.c
@@ -1127,15 +1127,14 @@ static int iproc_pcie_check_link(struct iproc_pcie *pcie)
 	u32 link_status, class;
 
 	pcie->link_is_active = false;
-	/* force class to PCI_CLASS_BRIDGE_PCI (0x0604) */
+	/* force class to PCI bridge Normal decode (0x060400) */
 #define PCI_BRIDGE_CTRL_REG_OFFSET      0x43c
-#define PCI_CLASS_BRIDGE_MASK           0xffff00
-#define PCI_CLASS_BRIDGE_SHIFT          8
+#define PCI_BRIDGE_CTRL_REG_CLASS_MASK  0xffffff
 	iproc_pci_raw_config_read32(pcie, 0,
 				    PCI_BRIDGE_CTRL_REG_OFFSET,
 				    4, &class);
-	class &= ~PCI_CLASS_BRIDGE_MASK;
-	class |= (PCI_CLASS_BRIDGE_PCI << PCI_CLASS_BRIDGE_SHIFT);
+	class &= ~PCI_BRIDGE_CTRL_REG_CLASS_MASK;
+	class |= (PCI_CLASS_BRIDGE_PCI << 8);
 	iproc_pci_raw_config_write32(pcie, 0,
 				     PCI_BRIDGE_CTRL_REG_OFFSET,
 				     4, class);
-- 
2.20.1


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

* Re: [PATCH u-boot-pci] pci: iproc: Set all 24 bits of PCI class code
  2022-01-05  9:50 [PATCH u-boot-pci] pci: iproc: Set all 24 bits of PCI class code Pali Rohár
@ 2022-01-05 16:55 ` Roman Bacik
  2022-01-25 15:58 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Roman Bacik @ 2022-01-05 16:55 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Bharat Gooty, Simon Glass, Stefan Roese, U-Boot Mailing List

On Wed, Jan 5, 2022 at 1:50 AM Pali Rohár <pali@kernel.org> wrote:
>
> Register 0x43c in its low 24 bits contains PCI class code.
>
> Update code to set all 24 bits of PCI class code and not only upper 16 bits
> of PCI class code.
>
> Use standard U-Boot macro (PCI_CLASS_BRIDGE_PCI << 8) for constructing all
> 24-bits of PCI class for PCI bridge Normal decode.
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
>
> ---
> Roman helped me with this change and confirmed that class code is stored
> really in bits [23:0] of custom register 0x43c (normally class code is
> stored in bits [31:8] of pci register 0x08).
> ---
>  drivers/pci/pcie_iproc.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pci/pcie_iproc.c b/drivers/pci/pcie_iproc.c
> index be03dcbd97c0..fe68e417ae80 100644
> --- a/drivers/pci/pcie_iproc.c
> +++ b/drivers/pci/pcie_iproc.c
> @@ -1127,15 +1127,14 @@ static int iproc_pcie_check_link(struct iproc_pcie *pcie)
>         u32 link_status, class;
>
>         pcie->link_is_active = false;
> -       /* force class to PCI_CLASS_BRIDGE_PCI (0x0604) */
> +       /* force class to PCI bridge Normal decode (0x060400) */
>  #define PCI_BRIDGE_CTRL_REG_OFFSET      0x43c
> -#define PCI_CLASS_BRIDGE_MASK           0xffff00
> -#define PCI_CLASS_BRIDGE_SHIFT          8
> +#define PCI_BRIDGE_CTRL_REG_CLASS_MASK  0xffffff
>         iproc_pci_raw_config_read32(pcie, 0,
>                                     PCI_BRIDGE_CTRL_REG_OFFSET,
>                                     4, &class);
> -       class &= ~PCI_CLASS_BRIDGE_MASK;
> -       class |= (PCI_CLASS_BRIDGE_PCI << PCI_CLASS_BRIDGE_SHIFT);
> +       class &= ~PCI_BRIDGE_CTRL_REG_CLASS_MASK;
> +       class |= (PCI_CLASS_BRIDGE_PCI << 8);
>         iproc_pci_raw_config_write32(pcie, 0,
>                                      PCI_BRIDGE_CTRL_REG_OFFSET,
>                                      4, class);
> --
> 2.20.1
>

Acked-by: Roman Bacik <roman.bacik@broadcom.com>

-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.

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

* Re: [PATCH u-boot-pci] pci: iproc: Set all 24 bits of PCI class code
  2022-01-05  9:50 [PATCH u-boot-pci] pci: iproc: Set all 24 bits of PCI class code Pali Rohár
  2022-01-05 16:55 ` Roman Bacik
@ 2022-01-25 15:58 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2022-01-25 15:58 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Roman Bacik, Bharat Gooty, Simon Glass, Stefan Roese, u-boot

[-- Attachment #1: Type: text/plain, Size: 518 bytes --]

On Wed, Jan 05, 2022 at 10:50:20AM +0100, Pali Rohár wrote:

> Register 0x43c in its low 24 bits contains PCI class code.
> 
> Update code to set all 24 bits of PCI class code and not only upper 16 bits
> of PCI class code.
> 
> Use standard U-Boot macro (PCI_CLASS_BRIDGE_PCI << 8) for constructing all
> 24-bits of PCI class for PCI bridge Normal decode.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Acked-by: Roman Bacik <roman.bacik@broadcom.com>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

end of thread, other threads:[~2022-01-25 15:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05  9:50 [PATCH u-boot-pci] pci: iproc: Set all 24 bits of PCI class code Pali Rohár
2022-01-05 16:55 ` Roman Bacik
2022-01-25 15:58 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.