powerpc/47x: Split ppc47x machine in two
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Sat, 18 Feb 2023 09:15:47 +0000 (10:15 +0100)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 15 Mar 2023 21:56:26 +0000 (08:56 +1100)
This machine matches two compatibles and sets .pci_irq_fixup
on one of them.

Split it into two machines, then the probe function can be dropped.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
[mpe: Drop references to ppc47x_probe() to fix build]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/6cb9865d916231c38401ba34ad1a98c249fae135.1676711562.git.christophe.leroy@csgroup.eu
arch/powerpc/platforms/44x/ppc476.c

index 7c91ac5a5241b594ea049107f11c91525cf88e9a..4641ae8c9b097e54531212d4ef0904f3a3928d02 100644 (file)
@@ -114,7 +114,8 @@ static int __init ppc47x_device_probe(void)
 
        return 0;
 }
-machine_device_initcall(ppc47x, ppc47x_device_probe);
+machine_device_initcall(ppc47x_akebono, ppc47x_device_probe);
+machine_device_initcall(ppc47x_currituck, ppc47x_device_probe);
 
 static void __init ppc47x_init_irq(void)
 {
@@ -249,7 +250,8 @@ fail:
        pr_info("%s: Unable to find board revision\n", __func__);
        return 0;
 }
-machine_arch_initcall(ppc47x, ppc47x_get_board_rev);
+machine_arch_initcall(ppc47x_akebono, ppc47x_get_board_rev);
+machine_arch_initcall(ppc47x_currituck, ppc47x_get_board_rev);
 
 /* Use USB controller should have been hardware swizzled but it wasn't :( */
 static void ppc47x_pci_irq_fixup(struct pci_dev *dev)
@@ -268,27 +270,22 @@ static void ppc47x_pci_irq_fixup(struct pci_dev *dev)
        }
 }
 
-/*
- * Called very early, MMU is off, device-tree isn't unflattened
- */
-static int __init ppc47x_probe(void)
-{
-       if (of_machine_is_compatible("ibm,akebono"))
-               return 1;
-
-       if (of_machine_is_compatible("ibm,currituck")) {
-               ppc_md.pci_irq_fixup = ppc47x_pci_irq_fixup;
-               return 1;
-       }
-
-       return 0;
-}
+define_machine(ppc47x_akebono) {
+       .name                   = "PowerPC 47x (akebono)",
+       .compatible             = "ibm,akebono",
+       .progress               = udbg_progress,
+       .init_IRQ               = ppc47x_init_irq,
+       .setup_arch             = ppc47x_setup_arch,
+       .restart                = ppc4xx_reset_system,
+       .calibrate_decr         = generic_calibrate_decr,
+};
 
-define_machine(ppc47x) {
-       .name                   = "PowerPC 47x",
-       .probe                  = ppc47x_probe,
+define_machine(ppc47x_currituck) {
+       .name                   = "PowerPC 47x (currituck)",
+       .compatible             = "ibm,currituck",
        .progress               = udbg_progress,
        .init_IRQ               = ppc47x_init_irq,
+       .pci_irq_fixup          = ppc47x_pci_irq_fixup,
        .setup_arch             = ppc47x_setup_arch,
        .restart                = ppc4xx_reset_system,
        .calibrate_decr         = generic_calibrate_decr,