Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4f740cf authored by Grant Likely's avatar Grant Likely
Browse files

of/flattree: Add of_flat_dt_match() helper function



This patch adds of_flat_dt_match() which tests a node for
compatibility with a list of values and converts the relevant powerpc
platform code to use it.  This approach simplifies the board support
code a bit.

Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
Reviewed-by: default avatarStephen Neuendorffer <stephen.neuendorffer@xilinx.com>
parent 73930a85
Loading
Loading
Loading
Loading
+4 −9
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ machine_device_initcall(ppc40x_simple, ppc40x_device_probe);
 * Again, if your board needs to do things differently then create a
 * board.c file for it rather than adding it to this list.
 */
static char *board[] __initdata = {
static const char *board[] __initdata = {
	"amcc,acadia",
	"amcc,haleakala",
	"amcc,kilauea",
@@ -60,15 +60,10 @@ static char *board[] __initdata = {

static int __init ppc40x_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_flat_dt_match(of_get_flat_dt_root(), board)) {
		ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC);
		return 1;
	}
	}

	return 0;
}
+2 −11
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@
/*
 * list of supported boards
 */
static char *board[] __initdata = {
static const char *board[] __initdata = {
	"prt,prtlvt",
	NULL
};
@@ -36,16 +36,7 @@ static char *board[] __initdata = {
 */
static int __init mpc5121_generic_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]))
			break;
		i++;
	}

	return board[i] != NULL;
	return of_flat_dt_match(of_get_flat_dt_root(), board);
}

define_machine(mpc5121_generic) {
+7 −9
Original line number Diff line number Diff line
@@ -172,20 +172,18 @@ static void __init lite5200_setup_arch(void)
	mpc52xx_setup_pci();
}

static const char *board[] __initdata = {
	"fsl,lite5200",
	"fsl,lite5200b",
	NULL,
};

/*
 * Called very early, MMU is off, device-tree isn't unflattened
 */
static int __init lite5200_probe(void)
{
	unsigned long node = of_get_flat_dt_root();
	const char *model = of_get_flat_dt_prop(node, "model", NULL);

	if (!of_flat_dt_is_compatible(node, "fsl,lite5200") &&
	    !of_flat_dt_is_compatible(node, "fsl,lite5200b"))
		return 0;
	pr_debug("%s board found\n", model ? model : "unknown");

	return 1;
	return of_flat_dt_match(of_get_flat_dt_root(), board);
}

define_machine(lite5200) {
+2 −11
Original line number Diff line number Diff line
@@ -239,7 +239,7 @@ static void __init media5200_setup_arch(void)
}

/* list of the supported boards */
static char *board[] __initdata = {
static const char *board[] __initdata = {
	"fsl,media5200",
	NULL
};
@@ -249,16 +249,7 @@ static char *board[] __initdata = {
 */
static int __init media5200_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]))
			break;
		i++;
	}

	return (board[i] != NULL);
	return of_flat_dt_match(of_get_flat_dt_root(), board);
}

define_machine(media5200_platform) {
+2 −11
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ static void __init mpc5200_simple_setup_arch(void)
}

/* list of the supported boards */
static char *board[] __initdata = {
static const char *board[] __initdata = {
	"intercontrol,digsy-mtc",
	"manroland,mucmc52",
	"manroland,uc101",
@@ -66,16 +66,7 @@ static char *board[] __initdata = {
 */
static int __init mpc5200_simple_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]))
			break;
		i++;
	}
	
	return (board[i] != NULL);
	return of_flat_dt_match(of_get_flat_dt_root(), board);
}

define_machine(mpc5200_simple_platform) {
Loading