lkml.org 
[lkml]   [2005]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH] ppc32: ppc_sys system on chip identification additions
Date
Oops, this patch doesn't build since its missing a '{'.  Will send up  
an updated patch that fixes the problem.

- kumar

On Aug 24, 2005, at 10:18 AM, Gala Kumar K.-galak wrote:

> 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 <vbordug@ru.mvista.com>
> Signed-off-by: Kumar Gala <kumar.gala@freescale.com>
>
> ---
> commit 58d478e75ac5d6cb3a1f738a22555c3841445264
> tree 999d1722d74eb8dc76f40c8f4c52966cea681cb4
> parent eb5d5922d749a74f58416ca1a852651e7323449b
> author Kumar K. Gala <kumar.gala@freescale.com> Wed, 24 Aug 2005
> 10:14:42 -0500
> committer Kumar K. Gala <kumar.gala@freescale.com> Wed, 24 Aug 2005
> 10:14:42 -0500
>
> arch/ppc/syslib/ppc_sys.c | 51
> ++++++++++++++++++++++++++++++++++++++++++++-
> include/asm-ppc/ppc_sys.h | 1 +
> 2 files changed, 51 insertions(+), 1 deletions(-)
>
> diff --git a/arch/ppc/syslib/ppc_sys.c b/arch/ppc/syslib/ppc_sys.c
> --- a/arch/ppc/syslib/ppc_sys.c
> +++ b/arch/ppc/syslib/ppc_sys.c
> @@ -6,6 +6,7 @@
> * Maintainer: Kumar Gala <kumar.gala@freescale.com>
> *
> * Copyright 2005 Freescale Semiconductor Inc.
> + * Copyright 2005 MontaVista, Inc. by Vitaly Bordug
> <vbordug@ru.mvista.com>
> *
> * 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,8 +36,56 @@ void __init identify_ppc_sys_by_id(u32 i
>
> 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 */
> diff --git a/include/asm-ppc/ppc_sys.h b/include/asm-ppc/ppc_sys.h
> --- a/include/asm-ppc/ppc_sys.h
> +++ b/include/asm-ppc/ppc_sys.h
> @@ -50,6 +50,7 @@ extern struct ppc_sys_spec *cur_ppc_sys_
> /* determine which specific SOC we are */
> extern void identify_ppc_sys_by_id(u32 id) __init;
> extern void identify_ppc_sys_by_name(char *name) __init;
> +extern void identify_ppc_sys_by_name_and_id(char *name, u32 id)
> __init;
>
> /* describes all devices that may exist in a given family of
> processors
> */
> extern struct platform_device ppc_sys_platform_devices[];
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-08-26 20:50    [W:0.035 / U:0.920 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site