forked from analogdevicesinc/linux
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PATCH] ppc32: ppc_sys system on chip identification additions
Add the ability to identify an SOC by a name and id. There are cases in which the integer identifier is not sufficient to specify a specific SOC. In these cases we can use a string to further qualify the match. Signed-off-by: Vitaly Bordug <[email protected]> Signed-off-by: Kumar Gala <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
- Loading branch information
Kumar Gala
authored and
Linus Torvalds
committed
Sep 5, 2005
1 parent
fa71f0e
commit 88adfe7
Showing
2 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
* Maintainer: Kumar Gala <[email protected]> | ||
* | ||
* Copyright 2005 Freescale Semiconductor Inc. | ||
* Copyright 2005 MontaVista, Inc. by Vitaly Bordug <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the | ||
|
@@ -35,10 +36,59 @@ void __init identify_ppc_sys_by_id(u32 id) | |
|
||
void __init identify_ppc_sys_by_name(char *name) | ||
{ | ||
/* TODO */ | ||
unsigned int i = 0; | ||
while (ppc_sys_specs[i].ppc_sys_name[0]) | ||
{ | ||
if (!strcmp(ppc_sys_specs[i].ppc_sys_name, name)) | ||
break; | ||
i++; | ||
} | ||
cur_ppc_sys_spec = &ppc_sys_specs[i]; | ||
return; | ||
} | ||
|
||
static int __init count_sys_specs(void) | ||
{ | ||
int i = 0; | ||
while (ppc_sys_specs[i].ppc_sys_name[0]) | ||
i++; | ||
return i; | ||
} | ||
|
||
static int __init find_chip_by_name_and_id(char *name, u32 id) | ||
{ | ||
int ret = -1; | ||
unsigned int i = 0; | ||
unsigned int j = 0; | ||
unsigned int dups = 0; | ||
|
||
unsigned char matched[count_sys_specs()]; | ||
|
||
while (ppc_sys_specs[i].ppc_sys_name[0]) { | ||
if (!strcmp(ppc_sys_specs[i].ppc_sys_name, name)) | ||
matched[j++] = i; | ||
i++; | ||
} | ||
if (j != 0) { | ||
for (i = 0; i < j; i++) { | ||
if ((ppc_sys_specs[matched[i]].mask & id) == | ||
ppc_sys_specs[matched[i]].value) { | ||
ret = matched[i]; | ||
dups++; | ||
} | ||
} | ||
ret = (dups == 1) ? ret : (-1 * dups); | ||
} | ||
return ret; | ||
} | ||
|
||
void __init identify_ppc_sys_by_name_and_id(char *name, u32 id) | ||
{ | ||
int i = find_chip_by_name_and_id(name, id); | ||
BUG_ON(i < 0); | ||
cur_ppc_sys_spec = &ppc_sys_specs[i]; | ||
} | ||
|
||
/* Update all memory resources by paddr, call before platform_device_register */ | ||
void __init | ||
ppc_sys_fixup_mem_resource(struct platform_device *pdev, phys_addr_t paddr) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters