linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: ixp4xx: Use PCI_CONF1_ADDRESS() macro
@ 2022-09-28 12:25 Pali Rohár
  2022-10-04  7:56 ` Linus Walleij
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Pali Rohár @ 2022-09-28 12:25 UTC (permalink / raw)
  To: Linus Walleij, Lorenzo Pieralisi, Rob Herring,
	Krzysztof Wilczyński, Bjorn Helgaas
  Cc: linux-pci, linux-kernel

Simplify pci-ixp4xx.c driver code and use new PCI_CONF1_ADDRESS() macro for
accessing PCI config space.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 drivers/pci/controller/pci-ixp4xx.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/controller/pci-ixp4xx.c b/drivers/pci/controller/pci-ixp4xx.c
index 654ac4a82beb..c83b5ae0b017 100644
--- a/drivers/pci/controller/pci-ixp4xx.c
+++ b/drivers/pci/controller/pci-ixp4xx.c
@@ -188,12 +188,13 @@ static u32 ixp4xx_config_addr(u8 bus_num, u16 devfn, int where)
 	/* Root bus is always 0 in this hardware */
 	if (bus_num == 0) {
 		/* type 0 */
-		return BIT(32-PCI_SLOT(devfn)) | ((PCI_FUNC(devfn)) << 8) |
-			(where & ~3);
+		return (PCI_CONF1_ADDRESS(0, 0, PCI_FUNC(devfn), where) &
+			~PCI_CONF1_ENABLE) | BIT(32-PCI_SLOT(devfn));
 	} else {
 		/* type 1 */
-		return (bus_num << 16) | ((PCI_SLOT(devfn)) << 11) |
-			((PCI_FUNC(devfn)) << 8) | (where & ~3) | 1;
+		return (PCI_CONF1_ADDRESS(bus_num, PCI_SLOT(devfn),
+					  PCI_FUNC(devfn), where) &
+			~PCI_CONF1_ENABLE) | 1;
 	}
 }
 
-- 
2.20.1


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

* Re: [PATCH] PCI: ixp4xx: Use PCI_CONF1_ADDRESS() macro
  2022-09-28 12:25 [PATCH] PCI: ixp4xx: Use PCI_CONF1_ADDRESS() macro Pali Rohár
@ 2022-10-04  7:56 ` Linus Walleij
  2022-10-04  8:41   ` Pali Rohár
  2023-03-10 13:57   ` Lorenzo Pieralisi
  2023-03-10 22:38 ` Linus Walleij
  2023-03-24 15:51 ` Lorenzo Pieralisi
  2 siblings, 2 replies; 7+ messages in thread
From: Linus Walleij @ 2022-10-04  7:56 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Lorenzo Pieralisi, Rob Herring, Krzysztof Wilczyński,
	Bjorn Helgaas, linux-pci, linux-kernel

On Wed, Sep 28, 2022 at 2:25 PM Pali Rohár <pali@kernel.org> wrote:

> Simplify pci-ixp4xx.c driver code and use new PCI_CONF1_ADDRESS() macro for
> accessing PCI config space.
>
> Signed-off-by: Pali Rohár <pali@kernel.org>

I have no way to evaluate this change in my head, once the kernel test robot is
happy I can test the patch on IXP4xx.

Yours,
Linus Walleij

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

* Re: [PATCH] PCI: ixp4xx: Use PCI_CONF1_ADDRESS() macro
  2022-10-04  7:56 ` Linus Walleij
@ 2022-10-04  8:41   ` Pali Rohár
  2023-03-10 13:57   ` Lorenzo Pieralisi
  1 sibling, 0 replies; 7+ messages in thread
From: Pali Rohár @ 2022-10-04  8:41 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Lorenzo Pieralisi, Rob Herring, Krzysztof Wilczyński,
	Bjorn Helgaas, linux-pci, linux-kernel

On Tuesday 04 October 2022 09:56:18 Linus Walleij wrote:
> On Wed, Sep 28, 2022 at 2:25 PM Pali Rohár <pali@kernel.org> wrote:
> 
> > Simplify pci-ixp4xx.c driver code and use new PCI_CONF1_ADDRESS() macro for
> > accessing PCI config space.
> >
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> 
> I have no way to evaluate this change in my head, once the kernel test robot is
> happy I can test the patch on IXP4xx.
> 
> Yours,
> Linus Walleij

You just need to apply this change on Lorenzo's pci tree. Or wait until
Lorenzo's changes are propagated into master tree and then robot should
be happy.

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

* Re: [PATCH] PCI: ixp4xx: Use PCI_CONF1_ADDRESS() macro
  2022-10-04  7:56 ` Linus Walleij
  2022-10-04  8:41   ` Pali Rohár
@ 2023-03-10 13:57   ` Lorenzo Pieralisi
  2023-03-10 22:38     ` Linus Walleij
  1 sibling, 1 reply; 7+ messages in thread
From: Lorenzo Pieralisi @ 2023-03-10 13:57 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Pali Rohár, Rob Herring, Krzysztof Wilczyński,
	Bjorn Helgaas, linux-pci, linux-kernel

On Tue, Oct 04, 2022 at 09:56:18AM +0200, Linus Walleij wrote:
> On Wed, Sep 28, 2022 at 2:25 PM Pali Rohár <pali@kernel.org> wrote:
> 
> > Simplify pci-ixp4xx.c driver code and use new PCI_CONF1_ADDRESS() macro for
> > accessing PCI config space.
> >
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> 
> I have no way to evaluate this change in my head, once the kernel test robot is
> happy I can test the patch on IXP4xx.

If you can manage to test it I can go ahead and merge it.

Thanks,
Lorenzo

> Yours,
> Linus Walleij

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

* Re: [PATCH] PCI: ixp4xx: Use PCI_CONF1_ADDRESS() macro
  2022-09-28 12:25 [PATCH] PCI: ixp4xx: Use PCI_CONF1_ADDRESS() macro Pali Rohár
  2022-10-04  7:56 ` Linus Walleij
@ 2023-03-10 22:38 ` Linus Walleij
  2023-03-24 15:51 ` Lorenzo Pieralisi
  2 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2023-03-10 22:38 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Lorenzo Pieralisi, Rob Herring, Krzysztof Wilczyński,
	Bjorn Helgaas, linux-pci, linux-kernel

On Wed, Sep 28, 2022 at 2:25 PM Pali Rohár <pali@kernel.org> wrote:

> Simplify pci-ixp4xx.c driver code and use new PCI_CONF1_ADDRESS() macro for
> accessing PCI config space.
>
> Signed-off-by: Pali Rohár <pali@kernel.org>

This does not compile right off (on kernel v6.3-rc1), I had to add this:

diff --git a/drivers/pci/controller/pci-ixp4xx.c
b/drivers/pci/controller/pci-ixp4xx.c
index c83b5ae0b017..e44252db6085 100644
--- a/drivers/pci/controller/pci-ixp4xx.c
+++ b/drivers/pci/controller/pci-ixp4xx.c
@@ -26,6 +26,7 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/bits.h>
+#include "../pci.h"

 /* Register offsets */
 #define IXP4XX_PCI_NP_AD               0x00

After this it compiles, boots and mounts root on a PCI-USB-connected
rootfs, so it seems to work fine!
Tested-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH] PCI: ixp4xx: Use PCI_CONF1_ADDRESS() macro
  2023-03-10 13:57   ` Lorenzo Pieralisi
@ 2023-03-10 22:38     ` Linus Walleij
  0 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2023-03-10 22:38 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: Pali Rohár, Rob Herring, Krzysztof Wilczyński,
	Bjorn Helgaas, linux-pci, linux-kernel

On Fri, Mar 10, 2023 at 2:57 PM Lorenzo Pieralisi <lpieralisi@kernel.org> wrote:
> On Tue, Oct 04, 2022 at 09:56:18AM +0200, Linus Walleij wrote:
> > On Wed, Sep 28, 2022 at 2:25 PM Pali Rohár <pali@kernel.org> wrote:
> >
> > > Simplify pci-ixp4xx.c driver code and use new PCI_CONF1_ADDRESS() macro for
> > > accessing PCI config space.
> > >
> > > Signed-off-by: Pali Rohár <pali@kernel.org>
> >
> > I have no way to evaluate this change in my head, once the kernel test robot is
> > happy I can test the patch on IXP4xx.
>
> If you can manage to test it I can go ahead and merge it.

I managed to test it with a oneliner to add the right include on top
of v6.3-rc1.

Yours,
Linus Walleij

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

* Re: [PATCH] PCI: ixp4xx: Use PCI_CONF1_ADDRESS() macro
  2022-09-28 12:25 [PATCH] PCI: ixp4xx: Use PCI_CONF1_ADDRESS() macro Pali Rohár
  2022-10-04  7:56 ` Linus Walleij
  2023-03-10 22:38 ` Linus Walleij
@ 2023-03-24 15:51 ` Lorenzo Pieralisi
  2 siblings, 0 replies; 7+ messages in thread
From: Lorenzo Pieralisi @ 2023-03-24 15:51 UTC (permalink / raw)
  To: Linus Walleij, Rob Herring, Krzysztof Wilczyński,
	Bjorn Helgaas, Pali Rohár
  Cc: Lorenzo Pieralisi, linux-pci, linux-kernel

On Wed, 28 Sep 2022 14:25:39 +0200, Pali Rohár wrote:
> Simplify pci-ixp4xx.c driver code and use new PCI_CONF1_ADDRESS() macro for
> accessing PCI config space.
> 
> 

Applied to controller/ixp4xx, thanks!

[1/1] PCI: ixp4xx: Use PCI_CONF1_ADDRESS() macro
      https://git.kernel.org/pci/pci/c/6c6fa1f3f771

Thanks,
Lorenzo

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

end of thread, other threads:[~2023-03-24 15:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28 12:25 [PATCH] PCI: ixp4xx: Use PCI_CONF1_ADDRESS() macro Pali Rohár
2022-10-04  7:56 ` Linus Walleij
2022-10-04  8:41   ` Pali Rohár
2023-03-10 13:57   ` Lorenzo Pieralisi
2023-03-10 22:38     ` Linus Walleij
2023-03-10 22:38 ` Linus Walleij
2023-03-24 15:51 ` Lorenzo Pieralisi

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).