linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/8] powerpc/fsl_uli1575: Cleanups
@ 2023-04-09  0:08 Pali Rohár
  2023-04-09  0:08 ` [PATCH v3 1/8] powerpc/fsl_uli1575: Misc cleanup Pali Rohár
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Pali Rohár @ 2023-04-09  0:08 UTC (permalink / raw)
  To: Michael Ellerman, Christophe Leroy, Nicholas Piggin
  Cc: linuxppc-dev, linux-kernel

This patch series contains cleanups for fsl_uli1575 driver.

This patch series is prerequisite for another patch series:
"powerpc/85xx: p2020: Create one unified machine description"
https://lore.kernel.org/linuxppc-dev/20230408140122.25293-1-pali@kernel.org/t/#u

Changes in v3:
* Fixed compile error in the sixth patch when driver was explicitly
  enabled on unsupported platform

Changes in v2:
* Fixed compile error in the first patch when PCI is disabled

Christophe Leroy (1):
  powerpc/fsl_uli1575: Misc cleanup

Pali Rohár (7):
  powerpc/85xx: mpc85xx_ds: Simplify mpc85xx_exclude_device() function
  powerpc/fsl_uli1575: Simplify uli_exclude_device() usage
  powerpc/85xx: mpc85xx_ds: Move uli_init() code into its own driver
    file
  powerpc/85xx: mpc85xx_rdb: Do not automatically select FSL_ULI1575
  powerpc/fsl_uli1575: Allow to disable FSL_ULI1575 support
  powerpc/86xx: mpc86xx_hpcn: Call uli_init() instead of explicit
    ppc_md assignment
  powerpc/fsl_uli1575: Mark uli_exclude_device() as static

 arch/powerpc/include/asm/ppc-pci.h         |  8 +++++
 arch/powerpc/platforms/85xx/Kconfig        |  1 -
 arch/powerpc/platforms/85xx/mpc85xx_ds.c   | 39 ++--------------------
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 20 ++---------
 arch/powerpc/platforms/Kconfig             |  4 ++-
 arch/powerpc/platforms/fsl_uli1575.c       | 29 +++++++++++++---
 6 files changed, 40 insertions(+), 61 deletions(-)

-- 
2.20.1


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

* [PATCH v3 1/8] powerpc/fsl_uli1575: Misc cleanup
  2023-04-09  0:08 [PATCH v3 0/8] powerpc/fsl_uli1575: Cleanups Pali Rohár
@ 2023-04-09  0:08 ` Pali Rohár
  2023-04-09  0:08 ` [PATCH v3 2/8] powerpc/85xx: mpc85xx_ds: Simplify mpc85xx_exclude_device() function Pali Rohár
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Pali Rohár @ 2023-04-09  0:08 UTC (permalink / raw)
  To: Michael Ellerman, Christophe Leroy, Nicholas Piggin
  Cc: linuxppc-dev, linux-kernel

From: Christophe Leroy <christophe.leroy@csgroup.eu>

Use a single line for uli_exclude_device().

Add uli_exclude_device() prototype in ppc-pci.h and guard it.

Remove that prototype from mpc85xx_ds.c and mpc86xx_hpcn.c files.

Make uli_pirq_to_irq[] static as it is used only in that file.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Pali Rohár <pali@kernel.org>
---
 arch/powerpc/include/asm/ppc-pci.h         | 9 +++++++++
 arch/powerpc/platforms/85xx/mpc85xx_ds.c   | 4 +---
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 4 +---
 arch/powerpc/platforms/fsl_uli1575.c       | 6 +++---
 4 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/include/asm/ppc-pci.h b/arch/powerpc/include/asm/ppc-pci.h
index f6cf0159024e..a8db969dd595 100644
--- a/arch/powerpc/include/asm/ppc-pci.h
+++ b/arch/powerpc/include/asm/ppc-pci.h
@@ -57,11 +57,20 @@ void eeh_sysfs_remove_device(struct pci_dev *pdev);
 
 #endif /* CONFIG_EEH */
 
+#ifdef CONFIG_FSL_ULI1575
+int uli_exclude_device(struct pci_controller *hose, u_char bus, u_char devfn);
+#endif /* CONFIG_FSL_ULI1575 */
+
 #define PCI_BUSNO(bdfn) ((bdfn >> 8) & 0xff)
 
 #else /* CONFIG_PCI */
 static inline void init_pci_config_tokens(void) { }
 #endif /* !CONFIG_PCI */
 
+#if !defined(CONFIG_PCI) || !defined(CONFIG_FSL_ULI1575)
+#include <linux/pci.h>
+static inline int uli_exclude_device(struct pci_controller *hose, u_char bus, u_char devfn) { return PCIBIOS_SUCCESSFUL; }
+#endif /* !defined(CONFIG_PCI) || !defined(CONFIG_FSL_ULI1575) */
+
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_PPC_PCI_H */
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 70167b8f00a3..ed7b71d55b10 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -26,6 +26,7 @@
 #include <asm/mpic.h>
 #include <asm/i8259.h>
 #include <asm/swiotlb.h>
+#include <asm/ppc-pci.h>
 
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
@@ -107,9 +108,6 @@ void __init mpc85xx_ds_pic_init(void)
 }
 
 #ifdef CONFIG_PCI
-extern int uli_exclude_device(struct pci_controller *hose,
-				u_char bus, u_char devfn);
-
 static struct device_node *pci_with_uli;
 
 static int mpc85xx_exclude_device(struct pci_controller *hose,
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 7b00ebd2d7f8..3dbd396a0df5 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -22,6 +22,7 @@
 #include <mm/mmu_decl.h>
 #include <asm/udbg.h>
 #include <asm/swiotlb.h>
+#include <asm/ppc-pci.h>
 
 #include <asm/mpic.h>
 
@@ -39,9 +40,6 @@
 #endif
 
 #ifdef CONFIG_PCI
-extern int uli_exclude_device(struct pci_controller *hose,
-				u_char bus, u_char devfn);
-
 static int mpc86xx_exclude_device(struct pci_controller *hose,
 				   u_char bus, u_char devfn)
 {
diff --git a/arch/powerpc/platforms/fsl_uli1575.c b/arch/powerpc/platforms/fsl_uli1575.c
index 84afae7a2561..a32f9cef7845 100644
--- a/arch/powerpc/platforms/fsl_uli1575.c
+++ b/arch/powerpc/platforms/fsl_uli1575.c
@@ -13,6 +13,7 @@
 #include <linux/of_irq.h>
 
 #include <asm/pci-bridge.h>
+#include <asm/ppc-pci.h>
 
 #define ULI_PIRQA	0x08
 #define ULI_PIRQB	0x09
@@ -36,7 +37,7 @@
 #define ULI_8259_IRQ14	0x0d
 #define ULI_8259_IRQ15	0x0f
 
-u8 uli_pirq_to_irq[8] = {
+static u8 uli_pirq_to_irq[8] = {
 	ULI_8259_IRQ9,		/* PIRQA */
 	ULI_8259_IRQ10,		/* PIRQB */
 	ULI_8259_IRQ11,		/* PIRQC */
@@ -341,8 +342,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, hpcd_quirk_uli5288);
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, hpcd_quirk_uli5229);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x5288, hpcd_final_uli5288);
 
-int uli_exclude_device(struct pci_controller *hose,
-			u_char bus, u_char devfn)
+int uli_exclude_device(struct pci_controller *hose, u_char bus, u_char devfn)
 {
 	if (bus == (hose->first_busno + 2)) {
 		/* exclude Modem controller */
-- 
2.20.1


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

* [PATCH v3 2/8] powerpc/85xx: mpc85xx_ds: Simplify mpc85xx_exclude_device() function
  2023-04-09  0:08 [PATCH v3 0/8] powerpc/fsl_uli1575: Cleanups Pali Rohár
  2023-04-09  0:08 ` [PATCH v3 1/8] powerpc/fsl_uli1575: Misc cleanup Pali Rohár
@ 2023-04-09  0:08 ` Pali Rohár
  2023-04-09  0:08 ` [PATCH v3 3/8] powerpc/fsl_uli1575: Simplify uli_exclude_device() usage Pali Rohár
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Pali Rohár @ 2023-04-09  0:08 UTC (permalink / raw)
  To: Michael Ellerman, Christophe Leroy, Nicholas Piggin
  Cc: linuxppc-dev, linux-kernel

Function mpc85xx_exclude_device() is installed and used only when
pci_with_uli is fsl_pci_primary. So replace check for pci_with_uli by
fsl_pci_primary in mpc85xx_exclude_device() and move pci_with_uli variable
declaration into function mpc85xx_ds_uli_init() where it is used.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 arch/powerpc/platforms/85xx/mpc85xx_ds.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index ed7b71d55b10..0c905a838942 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -108,12 +108,10 @@ void __init mpc85xx_ds_pic_init(void)
 }
 
 #ifdef CONFIG_PCI
-static struct device_node *pci_with_uli;
-
 static int mpc85xx_exclude_device(struct pci_controller *hose,
 				   u_char bus, u_char devfn)
 {
-	if (hose->dn == pci_with_uli)
+	if (hose->dn == fsl_pci_primary)
 		return uli_exclude_device(hose, bus, devfn);
 
 	return PCIBIOS_SUCCESSFUL;
@@ -124,6 +122,7 @@ static void __init mpc85xx_ds_uli_init(void)
 {
 #ifdef CONFIG_PCI
 	struct device_node *node;
+	struct device_node *pci_with_uli;
 
 	/* See if we have a ULI under the primary */
 
-- 
2.20.1


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

* [PATCH v3 3/8] powerpc/fsl_uli1575: Simplify uli_exclude_device() usage
  2023-04-09  0:08 [PATCH v3 0/8] powerpc/fsl_uli1575: Cleanups Pali Rohár
  2023-04-09  0:08 ` [PATCH v3 1/8] powerpc/fsl_uli1575: Misc cleanup Pali Rohár
  2023-04-09  0:08 ` [PATCH v3 2/8] powerpc/85xx: mpc85xx_ds: Simplify mpc85xx_exclude_device() function Pali Rohár
@ 2023-04-09  0:08 ` Pali Rohár
  2023-04-09  0:08 ` [PATCH v3 4/8] powerpc/85xx: mpc85xx_ds: Move uli_init() code into its own driver file Pali Rohár
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Pali Rohár @ 2023-04-09  0:08 UTC (permalink / raw)
  To: Michael Ellerman, Christophe Leroy, Nicholas Piggin
  Cc: linuxppc-dev, linux-kernel

Function uli_exclude_device() is called only from mpc86xx_exclude_device()
and mpc85xx_exclude_device() functions. Both those functions are same, so
merge its logic directly into the uli_exclude_device() function.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 arch/powerpc/platforms/85xx/mpc85xx_ds.c   | 13 +------------
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 13 +------------
 arch/powerpc/platforms/fsl_uli1575.c       |  4 +++-
 3 files changed, 5 insertions(+), 25 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 0c905a838942..581b5f0ef3be 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -107,17 +107,6 @@ void __init mpc85xx_ds_pic_init(void)
 #endif	/* CONFIG_PPC_I8259 */
 }
 
-#ifdef CONFIG_PCI
-static int mpc85xx_exclude_device(struct pci_controller *hose,
-				   u_char bus, u_char devfn)
-{
-	if (hose->dn == fsl_pci_primary)
-		return uli_exclude_device(hose, bus, devfn);
-
-	return PCIBIOS_SUCCESSFUL;
-}
-#endif	/* CONFIG_PCI */
-
 static void __init mpc85xx_ds_uli_init(void)
 {
 #ifdef CONFIG_PCI
@@ -132,7 +121,7 @@ static void __init mpc85xx_ds_uli_init(void)
 		node = pci_with_uli;
 
 		if (pci_with_uli == fsl_pci_primary) {
-			ppc_md.pci_exclude_device = mpc85xx_exclude_device;
+			ppc_md.pci_exclude_device = uli_exclude_device;
 			break;
 		}
 	}
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 3dbd396a0df5..645125cc8420 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -39,17 +39,6 @@
 #define DBG(fmt...) do { } while(0)
 #endif
 
-#ifdef CONFIG_PCI
-static int mpc86xx_exclude_device(struct pci_controller *hose,
-				   u_char bus, u_char devfn)
-{
-	if (hose->dn == fsl_pci_primary)
-		return uli_exclude_device(hose, bus, devfn);
-
-	return PCIBIOS_SUCCESSFUL;
-}
-#endif /* CONFIG_PCI */
-
 
 static void __init
 mpc86xx_hpcn_setup_arch(void)
@@ -58,7 +47,7 @@ mpc86xx_hpcn_setup_arch(void)
 		ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0);
 
 #ifdef CONFIG_PCI
-	ppc_md.pci_exclude_device = mpc86xx_exclude_device;
+	ppc_md.pci_exclude_device = uli_exclude_device;
 #endif
 
 	printk("MPC86xx HPCN board from Freescale Semiconductor\n");
diff --git a/arch/powerpc/platforms/fsl_uli1575.c b/arch/powerpc/platforms/fsl_uli1575.c
index a32f9cef7845..1350db0b935d 100644
--- a/arch/powerpc/platforms/fsl_uli1575.c
+++ b/arch/powerpc/platforms/fsl_uli1575.c
@@ -15,6 +15,8 @@
 #include <asm/pci-bridge.h>
 #include <asm/ppc-pci.h>
 
+#include <sysdev/fsl_pci.h>
+
 #define ULI_PIRQA	0x08
 #define ULI_PIRQB	0x09
 #define ULI_PIRQC	0x0a
@@ -344,7 +346,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x5288, hpcd_final_uli5288);
 
 int uli_exclude_device(struct pci_controller *hose, u_char bus, u_char devfn)
 {
-	if (bus == (hose->first_busno + 2)) {
+	if (hose->dn == fsl_pci_primary && bus == (hose->first_busno + 2)) {
 		/* exclude Modem controller */
 		if ((PCI_SLOT(devfn) == 29) && (PCI_FUNC(devfn) == 1))
 			return PCIBIOS_DEVICE_NOT_FOUND;
-- 
2.20.1


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

* [PATCH v3 4/8] powerpc/85xx: mpc85xx_ds: Move uli_init() code into its own driver file
  2023-04-09  0:08 [PATCH v3 0/8] powerpc/fsl_uli1575: Cleanups Pali Rohár
                   ` (2 preceding siblings ...)
  2023-04-09  0:08 ` [PATCH v3 3/8] powerpc/fsl_uli1575: Simplify uli_exclude_device() usage Pali Rohár
@ 2023-04-09  0:08 ` Pali Rohár
  2023-04-09  0:08 ` [PATCH v3 5/8] powerpc/85xx: mpc85xx_rdb: Do not automatically select FSL_ULI1575 Pali Rohár
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Pali Rohár @ 2023-04-09  0:08 UTC (permalink / raw)
  To: Michael Ellerman, Christophe Leroy, Nicholas Piggin
  Cc: linuxppc-dev, linux-kernel

Move uli_init() function into existing driver fsl_uli1575.c file in order
to share its code between more platforms and board files.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 arch/powerpc/include/asm/ppc-pci.h       |  2 ++
 arch/powerpc/platforms/85xx/mpc85xx_ds.c | 23 +----------------------
 arch/powerpc/platforms/fsl_uli1575.c     | 19 +++++++++++++++++++
 3 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/arch/powerpc/include/asm/ppc-pci.h b/arch/powerpc/include/asm/ppc-pci.h
index a8db969dd595..0e393aeed912 100644
--- a/arch/powerpc/include/asm/ppc-pci.h
+++ b/arch/powerpc/include/asm/ppc-pci.h
@@ -59,6 +59,7 @@ void eeh_sysfs_remove_device(struct pci_dev *pdev);
 
 #ifdef CONFIG_FSL_ULI1575
 int uli_exclude_device(struct pci_controller *hose, u_char bus, u_char devfn);
+void __init uli_init(void);
 #endif /* CONFIG_FSL_ULI1575 */
 
 #define PCI_BUSNO(bdfn) ((bdfn >> 8) & 0xff)
@@ -70,6 +71,7 @@ static inline void init_pci_config_tokens(void) { }
 #if !defined(CONFIG_PCI) || !defined(CONFIG_FSL_ULI1575)
 #include <linux/pci.h>
 static inline int uli_exclude_device(struct pci_controller *hose, u_char bus, u_char devfn) { return PCIBIOS_SUCCESSFUL; }
+static inline void __init uli_init(void) {}
 #endif /* !defined(CONFIG_PCI) || !defined(CONFIG_FSL_ULI1575) */
 
 #endif /* __KERNEL__ */
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 581b5f0ef3be..c474da3eeea8 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -107,27 +107,6 @@ void __init mpc85xx_ds_pic_init(void)
 #endif	/* CONFIG_PPC_I8259 */
 }
 
-static void __init mpc85xx_ds_uli_init(void)
-{
-#ifdef CONFIG_PCI
-	struct device_node *node;
-	struct device_node *pci_with_uli;
-
-	/* See if we have a ULI under the primary */
-
-	node = of_find_node_by_name(NULL, "uli1575");
-	while ((pci_with_uli = of_get_parent(node))) {
-		of_node_put(node);
-		node = pci_with_uli;
-
-		if (pci_with_uli == fsl_pci_primary) {
-			ppc_md.pci_exclude_device = uli_exclude_device;
-			break;
-		}
-	}
-#endif
-}
-
 /*
  * Setup the architecture
  */
@@ -138,7 +117,7 @@ static void __init mpc85xx_ds_setup_arch(void)
 
 	swiotlb_detect_4g();
 	fsl_pci_assign_primary();
-	mpc85xx_ds_uli_init();
+	uli_init();
 	mpc85xx_smp_init();
 
 	printk("MPC85xx DS board from Freescale Semiconductor\n");
diff --git a/arch/powerpc/platforms/fsl_uli1575.c b/arch/powerpc/platforms/fsl_uli1575.c
index 1350db0b935d..b073db9d7c79 100644
--- a/arch/powerpc/platforms/fsl_uli1575.c
+++ b/arch/powerpc/platforms/fsl_uli1575.c
@@ -358,3 +358,22 @@ int uli_exclude_device(struct pci_controller *hose, u_char bus, u_char devfn)
 
 	return PCIBIOS_SUCCESSFUL;
 }
+
+void __init uli_init(void)
+{
+	struct device_node *node;
+	struct device_node *pci_with_uli;
+
+	/* See if we have a ULI under the primary */
+
+	node = of_find_node_by_name(NULL, "uli1575");
+	while ((pci_with_uli = of_get_parent(node))) {
+		of_node_put(node);
+		node = pci_with_uli;
+
+		if (pci_with_uli == fsl_pci_primary) {
+			ppc_md.pci_exclude_device = uli_exclude_device;
+			break;
+		}
+	}
+}
-- 
2.20.1


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

* [PATCH v3 5/8] powerpc/85xx: mpc85xx_rdb: Do not automatically select FSL_ULI1575
  2023-04-09  0:08 [PATCH v3 0/8] powerpc/fsl_uli1575: Cleanups Pali Rohár
                   ` (3 preceding siblings ...)
  2023-04-09  0:08 ` [PATCH v3 4/8] powerpc/85xx: mpc85xx_ds: Move uli_init() code into its own driver file Pali Rohár
@ 2023-04-09  0:08 ` Pali Rohár
  2023-04-09  0:08 ` [PATCH v3 6/8] powerpc/fsl_uli1575: Allow to disable FSL_ULI1575 support Pali Rohár
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Pali Rohár @ 2023-04-09  0:08 UTC (permalink / raw)
  To: Michael Ellerman, Christophe Leroy, Nicholas Piggin
  Cc: linuxppc-dev, linux-kernel

Boards provided by CONFIG_MPC85xx_RDB option do not initialize
fsl_uli1575.c driver. So remove explicit select dependency on it.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 arch/powerpc/platforms/85xx/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index b92cb2b4d54d..a8ce6616fd0a 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -90,7 +90,6 @@ config MPC85xx_RDB
 	bool "Freescale P102x MBG/UTM/RDB and P2020 RDB"
 	select PPC_I8259
 	select DEFAULT_UIMAGE
-	select FSL_ULI1575 if PCI
 	select SWIOTLB
 	help
 	  This option enables support for the P1020 MBG PC, P1020 UTM PC,
-- 
2.20.1


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

* [PATCH v3 6/8] powerpc/fsl_uli1575: Allow to disable FSL_ULI1575 support
  2023-04-09  0:08 [PATCH v3 0/8] powerpc/fsl_uli1575: Cleanups Pali Rohár
                   ` (4 preceding siblings ...)
  2023-04-09  0:08 ` [PATCH v3 5/8] powerpc/85xx: mpc85xx_rdb: Do not automatically select FSL_ULI1575 Pali Rohár
@ 2023-04-09  0:08 ` Pali Rohár
  2023-04-09  0:08 ` [PATCH v3 7/8] powerpc/86xx: mpc86xx_hpcn: Call uli_init() instead of explicit ppc_md assignment Pali Rohár
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Pali Rohár @ 2023-04-09  0:08 UTC (permalink / raw)
  To: Michael Ellerman, Christophe Leroy, Nicholas Piggin
  Cc: linuxppc-dev, linux-kernel

ULI1575 PCIe south bridge exists only on some Freescale boards. Allow to
disable CONFIG_FSL_ULI1575 symbol when it is not explicitly selected and
only implied. This is achieved by marking symbol as visible by providing
short description. Also adds dependency for this symbol to prevent enabling
it on platforms on which driver does not compile.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 arch/powerpc/platforms/Kconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index d41dad227de8..608ac0290e3a 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -261,7 +261,9 @@ config CPM2
 	  on it (826x, 827x, 8560).
 
 config FSL_ULI1575
-	bool
+	bool "ULI1575 PCIe south bridge support"
+	depends on FSL_SOC_BOOKE || PPC_86xx
+	select FSL_PCI
 	select GENERIC_ISA_DMA
 	help
 	  Supports for the ULI1575 PCIe south bridge that exists on some
-- 
2.20.1


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

* [PATCH v3 7/8] powerpc/86xx: mpc86xx_hpcn: Call uli_init() instead of explicit ppc_md assignment
  2023-04-09  0:08 [PATCH v3 0/8] powerpc/fsl_uli1575: Cleanups Pali Rohár
                   ` (5 preceding siblings ...)
  2023-04-09  0:08 ` [PATCH v3 6/8] powerpc/fsl_uli1575: Allow to disable FSL_ULI1575 support Pali Rohár
@ 2023-04-09  0:08 ` Pali Rohár
  2023-04-09  0:08 ` [PATCH v3 8/8] powerpc/fsl_uli1575: Mark uli_exclude_device() as static Pali Rohár
  2023-04-26 12:01 ` [PATCH v3 0/8] powerpc/fsl_uli1575: Cleanups Michael Ellerman
  8 siblings, 0 replies; 10+ messages in thread
From: Pali Rohár @ 2023-04-09  0:08 UTC (permalink / raw)
  To: Michael Ellerman, Christophe Leroy, Nicholas Piggin
  Cc: linuxppc-dev, linux-kernel

After calling fsl_pci_assign_primary(), it is possible to use uli_init() to
conditionally initialize ppc_md.pci_exclude_device callback based on the
uli1575 detection.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 645125cc8420..812110673d88 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -46,10 +46,6 @@ mpc86xx_hpcn_setup_arch(void)
 	if (ppc_md.progress)
 		ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0);
 
-#ifdef CONFIG_PCI
-	ppc_md.pci_exclude_device = uli_exclude_device;
-#endif
-
 	printk("MPC86xx HPCN board from Freescale Semiconductor\n");
 
 #ifdef CONFIG_SMP
@@ -57,6 +53,7 @@ mpc86xx_hpcn_setup_arch(void)
 #endif
 
 	fsl_pci_assign_primary();
+	uli_init();
 
 	swiotlb_detect_4g();
 }
-- 
2.20.1


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

* [PATCH v3 8/8] powerpc/fsl_uli1575: Mark uli_exclude_device() as static
  2023-04-09  0:08 [PATCH v3 0/8] powerpc/fsl_uli1575: Cleanups Pali Rohár
                   ` (6 preceding siblings ...)
  2023-04-09  0:08 ` [PATCH v3 7/8] powerpc/86xx: mpc86xx_hpcn: Call uli_init() instead of explicit ppc_md assignment Pali Rohár
@ 2023-04-09  0:08 ` Pali Rohár
  2023-04-26 12:01 ` [PATCH v3 0/8] powerpc/fsl_uli1575: Cleanups Michael Ellerman
  8 siblings, 0 replies; 10+ messages in thread
From: Pali Rohár @ 2023-04-09  0:08 UTC (permalink / raw)
  To: Michael Ellerman, Christophe Leroy, Nicholas Piggin
  Cc: linuxppc-dev, linux-kernel

Function uli_exclude_device() is not used outside of the fsl_uli1575.c
source file anymore. So mark it as static and remove public prototype.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 arch/powerpc/include/asm/ppc-pci.h   | 3 ---
 arch/powerpc/platforms/fsl_uli1575.c | 2 +-
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/powerpc/include/asm/ppc-pci.h b/arch/powerpc/include/asm/ppc-pci.h
index 0e393aeed912..d9fcff575027 100644
--- a/arch/powerpc/include/asm/ppc-pci.h
+++ b/arch/powerpc/include/asm/ppc-pci.h
@@ -58,7 +58,6 @@ void eeh_sysfs_remove_device(struct pci_dev *pdev);
 #endif /* CONFIG_EEH */
 
 #ifdef CONFIG_FSL_ULI1575
-int uli_exclude_device(struct pci_controller *hose, u_char bus, u_char devfn);
 void __init uli_init(void);
 #endif /* CONFIG_FSL_ULI1575 */
 
@@ -69,8 +68,6 @@ static inline void init_pci_config_tokens(void) { }
 #endif /* !CONFIG_PCI */
 
 #if !defined(CONFIG_PCI) || !defined(CONFIG_FSL_ULI1575)
-#include <linux/pci.h>
-static inline int uli_exclude_device(struct pci_controller *hose, u_char bus, u_char devfn) { return PCIBIOS_SUCCESSFUL; }
 static inline void __init uli_init(void) {}
 #endif /* !defined(CONFIG_PCI) || !defined(CONFIG_FSL_ULI1575) */
 
diff --git a/arch/powerpc/platforms/fsl_uli1575.c b/arch/powerpc/platforms/fsl_uli1575.c
index b073db9d7c79..b8d37a9932f1 100644
--- a/arch/powerpc/platforms/fsl_uli1575.c
+++ b/arch/powerpc/platforms/fsl_uli1575.c
@@ -344,7 +344,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, hpcd_quirk_uli5288);
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, hpcd_quirk_uli5229);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x5288, hpcd_final_uli5288);
 
-int uli_exclude_device(struct pci_controller *hose, u_char bus, u_char devfn)
+static int uli_exclude_device(struct pci_controller *hose, u_char bus, u_char devfn)
 {
 	if (hose->dn == fsl_pci_primary && bus == (hose->first_busno + 2)) {
 		/* exclude Modem controller */
-- 
2.20.1


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

* Re: [PATCH v3 0/8] powerpc/fsl_uli1575: Cleanups
  2023-04-09  0:08 [PATCH v3 0/8] powerpc/fsl_uli1575: Cleanups Pali Rohár
                   ` (7 preceding siblings ...)
  2023-04-09  0:08 ` [PATCH v3 8/8] powerpc/fsl_uli1575: Mark uli_exclude_device() as static Pali Rohár
@ 2023-04-26 12:01 ` Michael Ellerman
  8 siblings, 0 replies; 10+ messages in thread
From: Michael Ellerman @ 2023-04-26 12:01 UTC (permalink / raw)
  To: Michael Ellerman, Christophe Leroy, Nicholas Piggin,
	Pali Rohár
  Cc: linuxppc-dev, linux-kernel

On Sun, 09 Apr 2023 02:08:04 +0200, Pali Rohár wrote:
> This patch series contains cleanups for fsl_uli1575 driver.
> 
> This patch series is prerequisite for another patch series:
> "powerpc/85xx: p2020: Create one unified machine description"
> https://lore.kernel.org/linuxppc-dev/20230408140122.25293-1-pali@kernel.org/t/#u
> 
> Changes in v3:
> * Fixed compile error in the sixth patch when driver was explicitly
>   enabled on unsupported platform
> 
> [...]

Applied to powerpc/next.

[1/8] powerpc/fsl_uli1575: Misc cleanup
      https://git.kernel.org/powerpc/c/821b3a471f686910b97228010861c4a99d07fd86
[2/8] powerpc/85xx: mpc85xx_ds: Simplify mpc85xx_exclude_device() function
      https://git.kernel.org/powerpc/c/485536b9f289c8c3c86ecaad0f05a1a7b633cb8a
[3/8] powerpc/fsl_uli1575: Simplify uli_exclude_device() usage
      https://git.kernel.org/powerpc/c/aa9f3d2d619b878a66dc918d8b3bf984300f975f
[4/8] powerpc/85xx: mpc85xx_ds: Move uli_init() code into its own driver file
      https://git.kernel.org/powerpc/c/c4f6d8665cff0abacd164b3cd10afe0385290db2
[5/8] powerpc/85xx: mpc85xx_rdb: Do not automatically select FSL_ULI1575
      https://git.kernel.org/powerpc/c/304e364d1f89f590b72af6bec42b5199971b531b
[6/8] powerpc/fsl_uli1575: Allow to disable FSL_ULI1575 support
      https://git.kernel.org/powerpc/c/22fdf79171e8509db54599fd2c05ef0022ee83f5
[7/8] powerpc/86xx: mpc86xx_hpcn: Call uli_init() instead of explicit ppc_md assignment
      https://git.kernel.org/powerpc/c/40b221daf17bf8e0f27c7f1ffc8d5179d58e8597
[8/8] powerpc/fsl_uli1575: Mark uli_exclude_device() as static
      https://git.kernel.org/powerpc/c/3ce271435b717e1dbc4fc8191a69e88deb4f8990

cheers

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

end of thread, other threads:[~2023-04-26 12:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-09  0:08 [PATCH v3 0/8] powerpc/fsl_uli1575: Cleanups Pali Rohár
2023-04-09  0:08 ` [PATCH v3 1/8] powerpc/fsl_uli1575: Misc cleanup Pali Rohár
2023-04-09  0:08 ` [PATCH v3 2/8] powerpc/85xx: mpc85xx_ds: Simplify mpc85xx_exclude_device() function Pali Rohár
2023-04-09  0:08 ` [PATCH v3 3/8] powerpc/fsl_uli1575: Simplify uli_exclude_device() usage Pali Rohár
2023-04-09  0:08 ` [PATCH v3 4/8] powerpc/85xx: mpc85xx_ds: Move uli_init() code into its own driver file Pali Rohár
2023-04-09  0:08 ` [PATCH v3 5/8] powerpc/85xx: mpc85xx_rdb: Do not automatically select FSL_ULI1575 Pali Rohár
2023-04-09  0:08 ` [PATCH v3 6/8] powerpc/fsl_uli1575: Allow to disable FSL_ULI1575 support Pali Rohár
2023-04-09  0:08 ` [PATCH v3 7/8] powerpc/86xx: mpc86xx_hpcn: Call uli_init() instead of explicit ppc_md assignment Pali Rohár
2023-04-09  0:08 ` [PATCH v3 8/8] powerpc/fsl_uli1575: Mark uli_exclude_device() as static Pali Rohár
2023-04-26 12:01 ` [PATCH v3 0/8] powerpc/fsl_uli1575: Cleanups Michael Ellerman

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