Skip to content

Commit

Permalink
[POWERPC] 83xx: Cleaning up machine probing and board initcalls
Browse files Browse the repository at this point in the history
Cleaned up the probing functionality to be more consistent across all 83xx
boards and added machine_is() protection around board initcalls to ensure they
only do something if we are actually running on that board.

Additionally, removed some dead code on mpc832x_mds.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
  • Loading branch information
Kumar Gala committed Feb 17, 2007
1 parent 6624b35 commit 336c3c2
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 41 deletions.
11 changes: 2 additions & 9 deletions arch/powerpc/platforms/83xx/mpc8313_rdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,9 @@ void __init mpc8313_rdb_init_IRQ(void)
*/
static int __init mpc8313_rdb_probe(void)
{
char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
"model", NULL);
if (model == NULL)
return 0;
if (strcmp(model, "MPC8313ERDB"))
return 0;
unsigned long root = of_get_flat_dt_root();

DBG("MPC8313 RDB found\n");

return 1;
return of_flat_dt_is_compatible(root, "MPC8313ERDB");
}

define_machine(mpc8313_rdb) {
Expand Down
23 changes: 8 additions & 15 deletions arch/powerpc/platforms/83xx/mpc832x_mds.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ unsigned long isa_mem_base = 0;

static u8 *bcsr_regs = NULL;

u8 *get_bcsr(void)
{
return bcsr_regs;
}

/* ************************************************************************
*
* Setup the architecture
Expand Down Expand Up @@ -140,6 +135,9 @@ static int __init mpc832x_declare_of_platform_devices(void)
{
struct device_node *np;

if (!machine_is(mpc832x_mds))
return 0;

for (np = NULL; (np = of_find_compatible_node(np, "network",
"ucc_geth")) != NULL;) {
int ucc_num;
Expand Down Expand Up @@ -189,6 +187,9 @@ static int __init mpc832x_rtc_hookup(void)
{
struct timespec tv;

if (!machine_is(mpc832x_mds))
return 0;

ppc_md.get_rtc_time = ds1374_get_rtc_time;
ppc_md.set_rtc_time = ds1374_set_rtc_time;

Expand All @@ -207,17 +208,9 @@ late_initcall(mpc832x_rtc_hookup);
*/
static int __init mpc832x_sys_probe(void)
{
char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
"model", NULL);

if (model == NULL)
return 0;
if (strcmp(model, "MPC8323EMDS"))
return 0;

DBG("%s found\n", model);
unsigned long root = of_get_flat_dt_root();

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

define_machine(mpc832x_mds) {
Expand Down
7 changes: 3 additions & 4 deletions arch/powerpc/platforms/83xx/mpc834x_itx.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,9 @@ static void __init mpc834x_itx_init_IRQ(void)
*/
static int __init mpc834x_itx_probe(void)
{
/* We always match for now, eventually we should look at the flat
dev tree to ensure this is the board we are suppose to run on
*/
return 1;
unsigned long root = of_get_flat_dt_root();

return of_flat_dt_is_compatible(root, "MPC834xMITX");
}

define_machine(mpc834x_itx) {
Expand Down
10 changes: 6 additions & 4 deletions arch/powerpc/platforms/83xx/mpc834x_mds.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ static int __init mpc834x_rtc_hookup(void)
{
struct timespec tv;

if (!machine_is(mpc834x_mds))
return 0;

ppc_md.get_rtc_time = ds1374_get_rtc_time;
ppc_md.set_rtc_time = ds1374_set_rtc_time;

Expand All @@ -194,10 +197,9 @@ late_initcall(mpc834x_rtc_hookup);
*/
static int __init mpc834x_mds_probe(void)
{
/* We always match for now, eventually we should look at the flat
dev tree to ensure this is the board we are suppose to run on
*/
return 1;
unsigned long root = of_get_flat_dt_root();

return of_flat_dt_is_compatible(root, "MPC834xMDS");
}

define_machine(mpc834x_mds) {
Expand Down
17 changes: 8 additions & 9 deletions arch/powerpc/platforms/83xx/mpc8360e_pb.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ static int __init mpc8360_declare_of_platform_devices(void)
{
struct device_node *np;

if (!machine_is(mpc8360_sys))
return 0;

for (np = NULL; (np = of_find_compatible_node(np, "network",
"ucc_geth")) != NULL;) {
int ucc_num;
Expand Down Expand Up @@ -194,6 +197,9 @@ static int __init mpc8360_rtc_hookup(void)
{
struct timespec tv;

if (!machine_is(mpc8360_sys))
return 0;

ppc_md.get_rtc_time = ds1374_get_rtc_time;
ppc_md.set_rtc_time = ds1374_set_rtc_time;

Expand All @@ -212,16 +218,9 @@ late_initcall(mpc8360_rtc_hookup);
*/
static int __init mpc8360_sys_probe(void)
{
char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
"model", NULL);
if (model == NULL)
return 0;
if (strcmp(model, "MPC8360EPB"))
return 0;

DBG("MPC8360EMDS-PB found\n");
unsigned long root = of_get_flat_dt_root();

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

define_machine(mpc8360_sys) {
Expand Down

0 comments on commit 336c3c2

Please sign in to comment.