Skip to content

Commit

Permalink
powerpc: Move 32-bit probe() machine to later in the boot process
Browse files Browse the repository at this point in the history
This converts all the 32-bit platforms to use the expanded device-tree
which is a pretty mechanical change. Unlike 64-bit, the 32-bit kernel
didn't rely on platform initializations to setup the MMU since it
sets it up entirely before probe_machine() so the move has comparatively
less consequences though it's a bigger patch.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
  • Loading branch information
Benjamin Herrenschmidt authored and Michael Ellerman committed Jul 21, 2016
1 parent 406b0b6 commit 5657138
Show file tree
Hide file tree
Showing 83 changed files with 120 additions and 289 deletions.
35 changes: 19 additions & 16 deletions arch/powerpc/kernel/setup_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,7 @@ notrace void __init machine_init(u64 dt_ptr)

early_init_mmu();

probe_machine();

setup_kdump_trampoline();

#ifdef CONFIG_6xx
if (cpu_has_feature(CPU_FTR_CAN_DOZE) ||
cpu_has_feature(CPU_FTR_CAN_NAP))
ppc_md.power_save = ppc6xx_idle;
#endif

#ifdef CONFIG_E500
if (cpu_has_feature(CPU_FTR_CAN_DOZE) ||
cpu_has_feature(CPU_FTR_CAN_NAP))
ppc_md.power_save = e500_idle;
#endif
if (ppc_md.progress)
ppc_md.progress("id mach(): done", 0x200);
}

/* Checks "l2cr=xxxx" command-line option */
Expand Down Expand Up @@ -249,6 +233,21 @@ static void __init exc_lvl_early_init(void)
#define exc_lvl_early_init()
#endif

static void setup_power_save(void)
{
#ifdef CONFIG_6xx
if (cpu_has_feature(CPU_FTR_CAN_DOZE) ||
cpu_has_feature(CPU_FTR_CAN_NAP))
ppc_md.power_save = ppc6xx_idle;
#endif

#ifdef CONFIG_E500
if (cpu_has_feature(CPU_FTR_CAN_DOZE) ||
cpu_has_feature(CPU_FTR_CAN_NAP))
ppc_md.power_save = e500_idle;
#endif
}

/* Warning, IO base is not yet inited */
void __init setup_arch(char **cmdline_p)
{
Expand All @@ -260,6 +259,10 @@ void __init setup_arch(char **cmdline_p)
unflatten_device_tree();
check_for_initrd();

probe_machine();

setup_power_save();

if (ppc_md.init_early)
ppc_md.init_early();

Expand Down
4 changes: 1 addition & 3 deletions arch/powerpc/platforms/40x/ep405.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ static void __init ep405_setup_arch(void)

static int __init ep405_probe(void)
{
unsigned long root = of_get_flat_dt_root();

if (!of_flat_dt_is_compatible(root, "ep405"))
if (!of_machine_is_compatible("ep405"))
return 0;

return 1;
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/40x/ppc40x_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static const char * const board[] __initconst = {

static int __init ppc40x_probe(void)
{
if (of_flat_dt_match(of_get_flat_dt_root(), board)) {
if (of_device_compatible_match(of_root, board)) {
pci_set_flags(PCI_REASSIGN_ALL_RSRC);
return 1;
}
Expand Down
4 changes: 1 addition & 3 deletions arch/powerpc/platforms/40x/virtex.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ machine_device_initcall(virtex, virtex_device_probe);

static int __init virtex_probe(void)
{
unsigned long root = of_get_flat_dt_root();

if (!of_flat_dt_is_compatible(root, "xlnx,virtex"))
if (!of_machine_is_compatible("xlnx,virtex"))
return 0;

return 1;
Expand Down
4 changes: 1 addition & 3 deletions arch/powerpc/platforms/40x/walnut.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ machine_device_initcall(walnut, walnut_device_probe);

static int __init walnut_probe(void)
{
unsigned long root = of_get_flat_dt_root();

if (!of_flat_dt_is_compatible(root, "ibm,walnut"))
if (!of_machine_is_compatible("ibm,walnut"))
return 0;

pci_set_flags(PCI_REASSIGN_ALL_RSRC);
Expand Down
5 changes: 2 additions & 3 deletions arch/powerpc/platforms/44x/canyonlands.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ machine_device_initcall(canyonlands, ppc460ex_device_probe);

static int __init ppc460ex_probe(void)
{
unsigned long root = of_get_flat_dt_root();
if (of_flat_dt_is_compatible(root, "amcc,canyonlands")) {
if (of_machine_is_compatible("amcc,canyonlands")) {
pci_set_flags(PCI_REASSIGN_ALL_RSRC);
return 1;
}
}
return 0;
}

Expand Down
4 changes: 1 addition & 3 deletions arch/powerpc/platforms/44x/ebony.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ machine_device_initcall(ebony, ebony_device_probe);
*/
static int __init ebony_probe(void)
{
unsigned long root = of_get_flat_dt_root();

if (!of_flat_dt_is_compatible(root, "ibm,ebony"))
if (!of_machine_is_compatible("ibm,ebony"))
return 0;

pci_set_flags(PCI_REASSIGN_ALL_RSRC);
Expand Down
4 changes: 1 addition & 3 deletions arch/powerpc/platforms/44x/iss4xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,7 @@ static void __init iss4xx_setup_arch(void)
*/
static int __init iss4xx_probe(void)
{
unsigned long root = of_get_flat_dt_root();

if (!of_flat_dt_is_compatible(root, "ibm,iss-4xx"))
if (!of_machine_is_compatible("ibm,iss-4xx"))
return 0;

return 1;
Expand Down
3 changes: 1 addition & 2 deletions arch/powerpc/platforms/44x/ppc44x_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,10 @@ static char *board[] __initdata = {

static int __init ppc44x_probe(void)
{
unsigned long root = of_get_flat_dt_root();
int i = 0;

for (i = 0; i < ARRAY_SIZE(board); i++) {
if (of_flat_dt_is_compatible(root, board[i])) {
if (of_machine_is_compatible(board[i])) {
pci_set_flags(PCI_REASSIGN_ALL_RSRC);
return 1;
}
Expand Down
6 changes: 2 additions & 4 deletions arch/powerpc/platforms/44x/ppc476.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,10 @@ static void ppc47x_pci_irq_fixup(struct pci_dev *dev)
*/
static int __init ppc47x_probe(void)
{
unsigned long root = of_get_flat_dt_root();

if (of_flat_dt_is_compatible(root, "ibm,akebono"))
if (of_machine_is_compatible("ibm,akebono"))
return 1;

if (of_flat_dt_is_compatible(root, "ibm,currituck")) {
if (of_machine_is_compatible("ibm,currituck")) {
ppc_md.pci_irq_fixup = ppc47x_pci_irq_fixup;
return 1;
}
Expand Down
4 changes: 1 addition & 3 deletions arch/powerpc/platforms/44x/sam440ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ machine_device_initcall(sam440ep, sam440ep_device_probe);

static int __init sam440ep_probe(void)
{
unsigned long root = of_get_flat_dt_root();

if (!of_flat_dt_is_compatible(root, "acube,sam440ep"))
if (!of_machine_is_compatible("acube,sam440ep"))
return 0;

pci_set_flags(PCI_REASSIGN_ALL_RSRC);
Expand Down
4 changes: 1 addition & 3 deletions arch/powerpc/platforms/44x/virtex.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ machine_device_initcall(virtex, virtex_device_probe);

static int __init virtex_probe(void)
{
unsigned long root = of_get_flat_dt_root();

if (!of_flat_dt_is_compatible(root, "xlnx,virtex440"))
if (!of_machine_is_compatible("xlnx,virtex440"))
return 0;

return 1;
Expand Down
4 changes: 1 addition & 3 deletions arch/powerpc/platforms/44x/warp.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ machine_device_initcall(warp, warp_device_probe);

static int __init warp_probe(void)
{
unsigned long root = of_get_flat_dt_root();

if (!of_flat_dt_is_compatible(root, "pika,warp"))
if (!of_machine_is_compatible("pika,warp"))
return 0;

/* For __dma_alloc_coherent */
Expand Down
4 changes: 1 addition & 3 deletions arch/powerpc/platforms/512x/mpc5121_ads.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ static void __init mpc5121_ads_init_IRQ(void)
*/
static int __init mpc5121_ads_probe(void)
{
unsigned long root = of_get_flat_dt_root();

return of_flat_dt_is_compatible(root, "fsl,mpc5121ads");
return of_machine_is_compatible("fsl,mpc5121ads");
}

define_machine(mpc5121_ads) {
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/512x/mpc512x_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static const char * const board[] __initconst = {
*/
static int __init mpc512x_generic_probe(void)
{
return of_flat_dt_match(of_get_flat_dt_root(), board);
return of_device_compatible_match(of_root, board);
}

define_machine(mpc512x_generic) {
Expand Down
4 changes: 1 addition & 3 deletions arch/powerpc/platforms/512x/pdm360ng.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ void __init pdm360ng_init(void)

static int __init pdm360ng_probe(void)
{
unsigned long root = of_get_flat_dt_root();

return of_flat_dt_is_compatible(root, "ifm,pdm360ng");
return of_machine_is_compatible("ifm,pdm360ng");
}

define_machine(pdm360ng) {
Expand Down
3 changes: 1 addition & 2 deletions arch/powerpc/platforms/52xx/efika.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ static void __init efika_setup_arch(void)

static int __init efika_probe(void)
{
const char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
"model", NULL);
const char *model = of_get_property(of_root, "model", NULL);

if (model == NULL)
return 0;
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/52xx/lite5200.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ static const char * const board[] __initconst = {
*/
static int __init lite5200_probe(void)
{
return of_flat_dt_match(of_get_flat_dt_root(), board);
return of_device_compatible_match(of_root, board);
}

define_machine(lite5200) {
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/52xx/media5200.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ static const char * const board[] __initconst = {
*/
static int __init media5200_probe(void)
{
return of_flat_dt_match(of_get_flat_dt_root(), board);
return of_device_compatible_match(of_root, board);
}

define_machine(media5200_platform) {
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/52xx/mpc5200_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static const char *board[] __initdata = {
*/
static int __init mpc5200_simple_probe(void)
{
return of_flat_dt_match(of_get_flat_dt_root(), board);
return of_device_compatible_match(of_root, board);
}

define_machine(mpc5200_simple_platform) {
Expand Down
3 changes: 1 addition & 2 deletions arch/powerpc/platforms/82xx/ep8248e.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,7 @@ machine_device_initcall(ep8248e, declare_of_platform_devices);
*/
static int __init ep8248e_probe(void)
{
unsigned long root = of_get_flat_dt_root();
return of_flat_dt_is_compatible(root, "fsl,ep8248e");
return of_machine_is_compatible("fsl,ep8248e");
}

define_machine(ep8248e)
Expand Down
3 changes: 1 addition & 2 deletions arch/powerpc/platforms/82xx/km82xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,7 @@ machine_device_initcall(km82xx, declare_of_platform_devices);
*/
static int __init km82xx_probe(void)
{
unsigned long root = of_get_flat_dt_root();
return of_flat_dt_is_compatible(root, "keymile,km82xx");
return of_machine_is_compatible("keymile,km82xx");
}

define_machine(km82xx)
Expand Down
3 changes: 1 addition & 2 deletions arch/powerpc/platforms/82xx/mpc8272_ads.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,7 @@ machine_device_initcall(mpc8272_ads, declare_of_platform_devices);
*/
static int __init mpc8272_ads_probe(void)
{
unsigned long root = of_get_flat_dt_root();
return of_flat_dt_is_compatible(root, "fsl,mpc8272ads");
return of_machine_is_compatible("fsl,mpc8272ads");
}

define_machine(mpc8272_ads)
Expand Down
3 changes: 1 addition & 2 deletions arch/powerpc/platforms/82xx/pq2fads.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ static void __init pq2fads_setup_arch(void)
*/
static int __init pq2fads_probe(void)
{
unsigned long root = of_get_flat_dt_root();
return of_flat_dt_is_compatible(root, "fsl,pq2fads");
return of_machine_is_compatible("fsl,pq2fads");
}

static const struct of_device_id of_bus_ids[] __initconst = {
Expand Down
3 changes: 1 addition & 2 deletions arch/powerpc/platforms/83xx/asp834x.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ machine_device_initcall(asp834x, mpc83xx_declare_of_platform_devices);
*/
static int __init asp834x_probe(void)
{
unsigned long root = of_get_flat_dt_root();
return of_flat_dt_is_compatible(root, "analogue-and-micro,asp8347e");
return of_machine_is_compatible("analogue-and-micro,asp8347e");
}

define_machine(asp834x) {
Expand Down
3 changes: 1 addition & 2 deletions arch/powerpc/platforms/83xx/km83xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,10 @@ static char *board[] __initdata = {
*/
static int __init mpc83xx_km_probe(void)
{
unsigned long node = of_get_flat_dt_root();
int i = 0;

while (board[i]) {
if (of_flat_dt_is_compatible(node, board[i]))
if (of_machine_is_compatible(board[i]))
break;
i++;
}
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/83xx/mpc830x_rdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static const char *board[] __initdata = {
*/
static int __init mpc830x_rdb_probe(void)
{
return of_flat_dt_match(of_get_flat_dt_root(), board);
return of_device_compatible_match(of_root, board);
}

machine_device_initcall(mpc830x_rdb, mpc83xx_declare_of_platform_devices);
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/83xx/mpc831x_rdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static const char *board[] __initdata = {
*/
static int __init mpc831x_rdb_probe(void)
{
return of_flat_dt_match(of_get_flat_dt_root(), board);
return of_device_compatible_match(of_root, board);
}

machine_device_initcall(mpc831x_rdb, mpc83xx_declare_of_platform_devices);
Expand Down
4 changes: 1 addition & 3 deletions arch/powerpc/platforms/83xx/mpc832x_mds.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ machine_device_initcall(mpc832x_mds, mpc83xx_declare_of_platform_devices);
*/
static int __init mpc832x_sys_probe(void)
{
unsigned long root = of_get_flat_dt_root();

return of_flat_dt_is_compatible(root, "MPC832xMDS");
return of_machine_is_compatible("MPC832xMDS");
}

define_machine(mpc832x_mds) {
Expand Down
4 changes: 1 addition & 3 deletions arch/powerpc/platforms/83xx/mpc832x_rdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,7 @@ machine_device_initcall(mpc832x_rdb, mpc83xx_declare_of_platform_devices);
*/
static int __init mpc832x_rdb_probe(void)
{
unsigned long root = of_get_flat_dt_root();

return of_flat_dt_is_compatible(root, "MPC832xRDB");
return of_machine_is_compatible("MPC832xRDB");
}

define_machine(mpc832x_rdb) {
Expand Down
4 changes: 1 addition & 3 deletions arch/powerpc/platforms/83xx/mpc834x_itx.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ static void __init mpc834x_itx_setup_arch(void)
*/
static int __init mpc834x_itx_probe(void)
{
unsigned long root = of_get_flat_dt_root();

return of_flat_dt_is_compatible(root, "MPC834xMITX");
return of_machine_is_compatible("MPC834xMITX");
}

define_machine(mpc834x_itx) {
Expand Down
4 changes: 1 addition & 3 deletions arch/powerpc/platforms/83xx/mpc834x_mds.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ machine_device_initcall(mpc834x_mds, mpc83xx_declare_of_platform_devices);
*/
static int __init mpc834x_mds_probe(void)
{
unsigned long root = of_get_flat_dt_root();

return of_flat_dt_is_compatible(root, "MPC834xMDS");
return of_machine_is_compatible("MPC834xMDS");
}

define_machine(mpc834x_mds) {
Expand Down
4 changes: 1 addition & 3 deletions arch/powerpc/platforms/83xx/mpc836x_mds.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,7 @@ machine_arch_initcall(mpc836x_mds, mpc836x_usb_cfg);
*/
static int __init mpc836x_mds_probe(void)
{
unsigned long root = of_get_flat_dt_root();

return of_flat_dt_is_compatible(root, "MPC836xMDS");
return of_machine_is_compatible("MPC836xMDS");
}

define_machine(mpc836x_mds) {
Expand Down
Loading

0 comments on commit 5657138

Please sign in to comment.