提交 46d026ac 编写于 作者: D Dmitry Eremin-Solenikov 提交者: Kumar Gala

powerpc/85xx: consolidate of_platform_bus_probe calls

85xx board files have a lot of duplication in *_publish_devices()/
*_declare_of_platform_devices() functions. Merge that into a single
function common to most of the boards.
Signed-off-by: NDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: NKumar Gala <galak@kernel.crashing.org>
上级 543a07b1
...@@ -190,22 +190,7 @@ static void ksi8560_show_cpuinfo(struct seq_file *m) ...@@ -190,22 +190,7 @@ static void ksi8560_show_cpuinfo(struct seq_file *m)
seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
} }
static struct of_device_id __initdata of_bus_ids[] = { machine_device_initcall(ksi8560, mpc85xx_common_publish_devices);
{ .type = "soc", },
{ .type = "simple-bus", },
{ .name = "cpm", },
{ .name = "localbus", },
{ .compatible = "gianfar", },
{},
};
static int __init declare_of_platform_devices(void)
{
of_platform_bus_probe(NULL, of_bus_ids, NULL);
return 0;
}
machine_device_initcall(ksi8560, declare_of_platform_devices);
/* /*
* Called very early, device-tree isn't unflattened * Called very early, device-tree isn't unflattened
......
...@@ -106,19 +106,7 @@ static void __init mpc8536_ds_setup_arch(void) ...@@ -106,19 +106,7 @@ static void __init mpc8536_ds_setup_arch(void)
printk("MPC8536 DS board from Freescale Semiconductor\n"); printk("MPC8536 DS board from Freescale Semiconductor\n");
} }
static struct of_device_id __initdata mpc8536_ds_ids[] = { machine_device_initcall(mpc8536_ds, mpc85xx_common_publish_devices);
{ .type = "soc", },
{ .compatible = "soc", },
{ .compatible = "simple-bus", },
{ .compatible = "gianfar", },
{},
};
static int __init mpc8536_ds_publish_devices(void)
{
return of_platform_bus_probe(NULL, mpc8536_ds_ids, NULL);
}
machine_device_initcall(mpc8536_ds, mpc8536_ds_publish_devices);
machine_arch_initcall(mpc8536_ds, swiotlb_setup_bus_notifier); machine_arch_initcall(mpc8536_ds, swiotlb_setup_bus_notifier);
......
#ifndef MPC85xx_H #ifndef MPC85xx_H
#define MPC85xx_H #define MPC85xx_H
extern int mpc85xx_common_publish_devices(void);
#ifdef CONFIG_CPM2 #ifdef CONFIG_CPM2
extern void mpc85xx_cpm2_pic_init(void); extern void mpc85xx_cpm2_pic_init(void);
#else #else
......
...@@ -193,23 +193,7 @@ static void mpc85xx_ads_show_cpuinfo(struct seq_file *m) ...@@ -193,23 +193,7 @@ static void mpc85xx_ads_show_cpuinfo(struct seq_file *m)
seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
} }
static struct of_device_id __initdata of_bus_ids[] = { machine_device_initcall(mpc85xx_ads, mpc85xx_common_publish_devices);
{ .name = "soc", },
{ .type = "soc", },
{ .name = "cpm", },
{ .name = "localbus", },
{ .compatible = "simple-bus", },
{ .compatible = "gianfar", },
{},
};
static int __init declare_of_platform_devices(void)
{
of_platform_bus_probe(NULL, of_bus_ids, NULL);
return 0;
}
machine_device_initcall(mpc85xx_ads, declare_of_platform_devices);
/* /*
* Called very early, device-tree isn't unflattened * Called very early, device-tree isn't unflattened
......
...@@ -332,19 +332,7 @@ static int __init mpc85xx_cds_probe(void) ...@@ -332,19 +332,7 @@ static int __init mpc85xx_cds_probe(void)
return of_flat_dt_is_compatible(root, "MPC85xxCDS"); return of_flat_dt_is_compatible(root, "MPC85xxCDS");
} }
static struct of_device_id __initdata of_bus_ids[] = { machine_device_initcall(mpc85xx_cds, mpc85xx_common_publish_devices);
{ .type = "soc", },
{ .compatible = "soc", },
{ .compatible = "simple-bus", },
{ .compatible = "gianfar", },
{},
};
static int __init declare_of_platform_devices(void)
{
return of_platform_bus_probe(NULL, of_bus_ids, NULL);
}
machine_device_initcall(mpc85xx_cds, declare_of_platform_devices);
define_machine(mpc85xx_cds) { define_machine(mpc85xx_cds) {
.name = "MPC85xx CDS", .name = "MPC85xx CDS",
......
...@@ -11,6 +11,22 @@ ...@@ -11,6 +11,22 @@
#include "mpc85xx.h" #include "mpc85xx.h"
static struct of_device_id __initdata mpc85xx_common_ids[] = {
{ .type = "soc", },
{ .compatible = "soc", },
{ .compatible = "simple-bus", },
{ .name = "cpm", },
{ .name = "localbus", },
{ .compatible = "gianfar", },
{ .compatible = "fsl,qe", },
{ .compatible = "fsl,cpm2", },
{},
};
int __init mpc85xx_common_publish_devices(void)
{
return of_platform_bus_probe(NULL, mpc85xx_common_ids, NULL);
}
#ifdef CONFIG_CPM2 #ifdef CONFIG_CPM2
static void cpm2_cascade(unsigned int irq, struct irq_desc *desc) static void cpm2_cascade(unsigned int irq, struct irq_desc *desc)
{ {
......
...@@ -221,21 +221,9 @@ static int __init mpc8544_ds_probe(void) ...@@ -221,21 +221,9 @@ static int __init mpc8544_ds_probe(void)
return 0; return 0;
} }
static struct of_device_id __initdata mpc85xxds_ids[] = { machine_device_initcall(mpc8544_ds, mpc85xx_common_publish_devices);
{ .type = "soc", }, machine_device_initcall(mpc8572_ds, mpc85xx_common_publish_devices);
{ .compatible = "soc", }, machine_device_initcall(p2020_ds, mpc85xx_common_publish_devices);
{ .compatible = "simple-bus", },
{ .compatible = "gianfar", },
{},
};
static int __init mpc85xxds_publish_devices(void)
{
return of_platform_bus_probe(NULL, mpc85xxds_ids, NULL);
}
machine_device_initcall(mpc8544_ds, mpc85xxds_publish_devices);
machine_device_initcall(mpc8572_ds, mpc85xxds_publish_devices);
machine_device_initcall(p2020_ds, mpc85xxds_publish_devices);
machine_arch_initcall(mpc8544_ds, swiotlb_setup_bus_notifier); machine_arch_initcall(mpc8544_ds, swiotlb_setup_bus_notifier);
machine_arch_initcall(mpc8572_ds, swiotlb_setup_bus_notifier); machine_arch_initcall(mpc8572_ds, swiotlb_setup_bus_notifier);
......
...@@ -160,25 +160,6 @@ extern void __init mpc85xx_smp_init(void); ...@@ -160,25 +160,6 @@ extern void __init mpc85xx_smp_init(void);
#endif #endif
#ifdef CONFIG_QUICC_ENGINE #ifdef CONFIG_QUICC_ENGINE
static struct of_device_id mpc85xx_qe_ids[] __initdata = {
{ .type = "qe", },
{ .compatible = "fsl,qe", },
{ },
};
static void __init mpc85xx_publish_qe_devices(void)
{
struct device_node *np;
np = of_find_compatible_node(NULL, NULL, "fsl,qe");
if (!of_device_is_available(np)) {
of_node_put(np);
return;
}
of_platform_bus_probe(NULL, mpc85xx_qe_ids, NULL);
}
static void __init mpc85xx_mds_reset_ucc_phys(void) static void __init mpc85xx_mds_reset_ucc_phys(void)
{ {
struct device_node *np; struct device_node *np;
...@@ -349,7 +330,6 @@ static void __init mpc85xx_mds_qeic_init(void) ...@@ -349,7 +330,6 @@ static void __init mpc85xx_mds_qeic_init(void)
of_node_put(np); of_node_put(np);
} }
#else #else
static void __init mpc85xx_publish_qe_devices(void) { }
static void __init mpc85xx_mds_qe_init(void) { } static void __init mpc85xx_mds_qe_init(void) { }
static void __init mpc85xx_mds_qeic_init(void) { } static void __init mpc85xx_mds_qeic_init(void) { }
#endif /* CONFIG_QUICC_ENGINE */ #endif /* CONFIG_QUICC_ENGINE */
...@@ -431,24 +411,12 @@ machine_arch_initcall(mpc8568_mds, board_fixups); ...@@ -431,24 +411,12 @@ machine_arch_initcall(mpc8568_mds, board_fixups);
machine_arch_initcall(mpc8569_mds, board_fixups); machine_arch_initcall(mpc8569_mds, board_fixups);
static struct of_device_id mpc85xx_ids[] = { static struct of_device_id mpc85xx_ids[] = {
{ .type = "soc", },
{ .compatible = "soc", },
{ .compatible = "simple-bus", },
{ .compatible = "gianfar", },
{ .compatible = "fsl,srio", }, { .compatible = "fsl,srio", },
{ .compatible = "fsl,mpc8548-guts", }, { .compatible = "fsl,mpc8548-guts", },
{ .compatible = "gpio-leds", }, { .compatible = "gpio-leds", },
{}, {},
}; };
static struct of_device_id p1021_ids[] = {
{ .type = "soc", },
{ .compatible = "soc", },
{ .compatible = "simple-bus", },
{ .compatible = "gianfar", },
{},
};
static int __init mpc85xx_publish_devices(void) static int __init mpc85xx_publish_devices(void)
{ {
if (machine_is(mpc8568_mds)) if (machine_is(mpc8568_mds))
...@@ -456,23 +424,15 @@ static int __init mpc85xx_publish_devices(void) ...@@ -456,23 +424,15 @@ static int __init mpc85xx_publish_devices(void)
if (machine_is(mpc8569_mds)) if (machine_is(mpc8569_mds))
simple_gpiochip_init("fsl,mpc8569mds-bcsr-gpio"); simple_gpiochip_init("fsl,mpc8569mds-bcsr-gpio");
mpc85xx_common_publish_devices();
of_platform_bus_probe(NULL, mpc85xx_ids, NULL); of_platform_bus_probe(NULL, mpc85xx_ids, NULL);
mpc85xx_publish_qe_devices();
return 0;
}
static int __init p1021_publish_devices(void)
{
of_platform_bus_probe(NULL, p1021_ids, NULL);
mpc85xx_publish_qe_devices();
return 0; return 0;
} }
machine_device_initcall(mpc8568_mds, mpc85xx_publish_devices); machine_device_initcall(mpc8568_mds, mpc85xx_publish_devices);
machine_device_initcall(mpc8569_mds, mpc85xx_publish_devices); machine_device_initcall(mpc8569_mds, mpc85xx_publish_devices);
machine_device_initcall(p1021_mds, p1021_publish_devices); machine_device_initcall(p1021_mds, mpc85xx_common_publish_devices);
machine_arch_initcall(mpc8568_mds, swiotlb_setup_bus_notifier); machine_arch_initcall(mpc8568_mds, swiotlb_setup_bus_notifier);
machine_arch_initcall(mpc8569_mds, swiotlb_setup_bus_notifier); machine_arch_initcall(mpc8569_mds, swiotlb_setup_bus_notifier);
......
...@@ -111,20 +111,8 @@ static void __init mpc85xx_rdb_setup_arch(void) ...@@ -111,20 +111,8 @@ static void __init mpc85xx_rdb_setup_arch(void)
printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n"); printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n");
} }
static struct of_device_id __initdata mpc85xxrdb_ids[] = { machine_device_initcall(p2020_rdb, mpc85xx_common_publish_devices);
{ .type = "soc", }, machine_device_initcall(p1020_rdb, mpc85xx_common_publish_devices);
{ .compatible = "soc", },
{ .compatible = "simple-bus", },
{ .compatible = "gianfar", },
{},
};
static int __init mpc85xxrdb_publish_devices(void)
{
return of_platform_bus_probe(NULL, mpc85xxrdb_ids, NULL);
}
machine_device_initcall(p2020_rdb, mpc85xxrdb_publish_devices);
machine_device_initcall(p1020_rdb, mpc85xxrdb_publish_devices);
/* /*
* Called very early, device-tree isn't unflattened * Called very early, device-tree isn't unflattened
......
...@@ -327,10 +327,6 @@ static void __init p1022_ds_setup_arch(void) ...@@ -327,10 +327,6 @@ static void __init p1022_ds_setup_arch(void)
} }
static struct of_device_id __initdata p1022_ds_ids[] = { static struct of_device_id __initdata p1022_ds_ids[] = {
{ .type = "soc", },
{ .compatible = "soc", },
{ .compatible = "simple-bus", },
{ .compatible = "gianfar", },
/* So that the DMA channel nodes can be probed individually: */ /* So that the DMA channel nodes can be probed individually: */
{ .compatible = "fsl,eloplus-dma", }, { .compatible = "fsl,eloplus-dma", },
{}, {},
...@@ -338,6 +334,7 @@ static struct of_device_id __initdata p1022_ds_ids[] = { ...@@ -338,6 +334,7 @@ static struct of_device_id __initdata p1022_ds_ids[] = {
static int __init p1022_ds_publish_devices(void) static int __init p1022_ds_publish_devices(void)
{ {
mpc85xx_common_publish_devices();
return of_platform_bus_probe(NULL, p1022_ds_ids, NULL); return of_platform_bus_probe(NULL, p1022_ds_ids, NULL);
} }
machine_device_initcall(p1022_ds, p1022_ds_publish_devices); machine_device_initcall(p1022_ds, p1022_ds_publish_devices);
......
...@@ -48,6 +48,8 @@ ...@@ -48,6 +48,8 @@
#include <sysdev/fsl_soc.h> #include <sysdev/fsl_soc.h>
#include <sysdev/fsl_pci.h> #include <sysdev/fsl_pci.h>
#include "mpc85xx.h"
static int sbc_rev; static int sbc_rev;
static void __init sbc8548_pic_init(void) static void __init sbc8548_pic_init(void)
...@@ -149,21 +151,7 @@ static void sbc8548_show_cpuinfo(struct seq_file *m) ...@@ -149,21 +151,7 @@ static void sbc8548_show_cpuinfo(struct seq_file *m)
seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
} }
static struct of_device_id __initdata of_bus_ids[] = { machine_device_initcall(sbc8548, mpc85xx_common_publish_devices);
{ .name = "soc", },
{ .type = "soc", },
{ .compatible = "simple-bus", },
{ .compatible = "gianfar", },
{},
};
static int __init declare_of_platform_devices(void)
{
of_platform_bus_probe(NULL, of_bus_ids, NULL);
return 0;
}
machine_device_initcall(sbc8548, declare_of_platform_devices);
/* /*
* Called very early, device-tree isn't unflattened * Called very early, device-tree isn't unflattened
......
...@@ -180,23 +180,7 @@ static void sbc8560_show_cpuinfo(struct seq_file *m) ...@@ -180,23 +180,7 @@ static void sbc8560_show_cpuinfo(struct seq_file *m)
seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
} }
static struct of_device_id __initdata of_bus_ids[] = { machine_device_initcall(sbc8560, mpc85xx_common_publish_devices);
{ .name = "soc", },
{ .type = "soc", },
{ .name = "cpm", },
{ .name = "localbus", },
{ .compatible = "simple-bus", },
{ .compatible = "gianfar", },
{},
};
static int __init declare_of_platform_devices(void)
{
of_platform_bus_probe(NULL, of_bus_ids, NULL);
return 0;
}
machine_device_initcall(sbc8560, declare_of_platform_devices);
/* /*
* Called very early, device-tree isn't unflattened * Called very early, device-tree isn't unflattened
......
...@@ -97,17 +97,7 @@ static void __init socrates_setup_arch(void) ...@@ -97,17 +97,7 @@ static void __init socrates_setup_arch(void)
#endif #endif
} }
static struct of_device_id __initdata socrates_of_bus_ids[] = { machine_device_initcall(socrates, mpc85xx_common_publish_devices);
{ .compatible = "simple-bus", },
{ .compatible = "gianfar", },
{},
};
static int __init socrates_publish_devices(void)
{
return of_platform_bus_probe(NULL, socrates_of_bus_ids, NULL);
}
machine_device_initcall(socrates, socrates_publish_devices);
/* /*
* Called very early, device-tree isn't unflattened * Called very early, device-tree isn't unflattened
......
...@@ -113,19 +113,7 @@ static void stx_gp3_show_cpuinfo(struct seq_file *m) ...@@ -113,19 +113,7 @@ static void stx_gp3_show_cpuinfo(struct seq_file *m)
seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
} }
static struct of_device_id __initdata of_bus_ids[] = { machine_device_initcall(stx_gp3, mpc85xx_common_publish_devices);
{ .compatible = "simple-bus", },
{ .compatible = "gianfar", },
{},
};
static int __init declare_of_platform_devices(void)
{
of_platform_bus_probe(NULL, of_bus_ids, NULL);
return 0;
}
machine_device_initcall(stx_gp3, declare_of_platform_devices);
/* /*
* Called very early, device-tree isn't unflattened * Called very early, device-tree isn't unflattened
......
...@@ -142,19 +142,7 @@ static void __init tqm85xx_ti1520_fixup(struct pci_dev *pdev) ...@@ -142,19 +142,7 @@ static void __init tqm85xx_ti1520_fixup(struct pci_dev *pdev)
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1520, DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1520,
tqm85xx_ti1520_fixup); tqm85xx_ti1520_fixup);
static struct of_device_id __initdata of_bus_ids[] = { machine_device_initcall(tqm85xx, mpc85xx_common_publish_devices);
{ .compatible = "simple-bus", },
{ .compatible = "gianfar", },
{},
};
static int __init declare_of_platform_devices(void)
{
of_platform_bus_probe(NULL, of_bus_ids, NULL);
return 0;
}
machine_device_initcall(tqm85xx, declare_of_platform_devices);
static const char *board[] __initdata = { static const char *board[] __initdata = {
"tqc,tqm8540", "tqc,tqm8540",
......
...@@ -179,21 +179,9 @@ static void __init xes_mpc85xx_setup_arch(void) ...@@ -179,21 +179,9 @@ static void __init xes_mpc85xx_setup_arch(void)
#endif #endif
} }
static struct of_device_id __initdata xes_mpc85xx_ids[] = { machine_device_initcall(xes_mpc8572, mpc85xx_common_publish_devices);
{ .type = "soc", }, machine_device_initcall(xes_mpc8548, mpc85xx_common_publish_devices);
{ .compatible = "soc", }, machine_device_initcall(xes_mpc8540, mpc85xx_common_publish_devices);
{ .compatible = "simple-bus", },
{ .compatible = "gianfar", },
{},
};
static int __init xes_mpc85xx_publish_devices(void)
{
return of_platform_bus_probe(NULL, xes_mpc85xx_ids, NULL);
}
machine_device_initcall(xes_mpc8572, xes_mpc85xx_publish_devices);
machine_device_initcall(xes_mpc8548, xes_mpc85xx_publish_devices);
machine_device_initcall(xes_mpc8540, xes_mpc85xx_publish_devices);
/* /*
* Called very early, device-tree isn't unflattened * Called very early, device-tree isn't unflattened
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册