[PATCH 6/7] Add mpc512x_find_ips_freq

Grant Likely grant.likely at secretlab.ca
Wed Jan 9 04:27:46 EST 2008


Looks good to me; but I'd just merge this one with the earlier patch
that adds 5121 board support.

Cheers,
g.

On 1/8/08, John Rigby <jrigby at freescale.com> wrote:
> Added mpc512x_find_ips_freq needed by the following
> serial driver patch.  It is basically a renamed
> mpc512x_find_ipd_freq from 52xx.
>
> Signed-off-by: John Rigby <jrigby at freescale.com>
> ---
>  arch/powerpc/platforms/512x/mpc5121_ads.c |   28 ++++++++++++++++++++++++++++
>  include/asm-powerpc/mpc512x.h             |   22 ++++++++++++++++++++++
>  2 files changed, 50 insertions(+), 0 deletions(-)
>  create mode 100644 include/asm-powerpc/mpc512x.h
>
> diff --git a/arch/powerpc/platforms/512x/mpc5121_ads.c b/arch/powerpc/platforms/512x/mpc5121_ads.c
> index a860bf0..2f4cfee 100644
> --- a/arch/powerpc/platforms/512x/mpc5121_ads.c
> +++ b/arch/powerpc/platforms/512x/mpc5121_ads.c
> @@ -36,6 +36,34 @@
>  #include <asm/time.h>
>  #include <asm/of_platform.h>
>
> +/**
> + *     mpc512x_find_ips_freq - Find the IPB bus frequency for a device
> + *     @node:  device node
> + *
> + *     Returns IPS bus frequency, or 0 if the bus frequency cannot be found.
> + */
> +unsigned long
> +mpc512x_find_ips_freq(struct device_node *node)
> +{
> +       struct device_node *np;
> +       const unsigned int *p_ips_freq = NULL;
> +
> +       of_node_get(node);
> +       while (node) {
> +               p_ips_freq = of_get_property(node, "bus-frequency", NULL);
> +               if (p_ips_freq)
> +                       break;
> +
> +               np = of_get_parent(node);
> +               of_node_put(node);
> +               node = np;
> +       }
> +       if (node)
> +               of_node_put(node);
> +
> +       return p_ips_freq ? *p_ips_freq : 0;
> +}
> +
>  static void __init mpc5121_ads_setup_arch(void)
>  {
>         if (ppc_md.progress)
> diff --git a/include/asm-powerpc/mpc512x.h b/include/asm-powerpc/mpc512x.h
> new file mode 100644
> index 0000000..c48a165
> --- /dev/null
> +++ b/include/asm-powerpc/mpc512x.h
> @@ -0,0 +1,22 @@
> +/*
> + * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
> + *
> + * Author: John Rigby, <jrigby at freescale.com>, Friday Apr 13 2007
> + *
> + * Description:
> + * MPC5121 Prototypes and definitions
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + */
> +
> +#ifndef __ASM_POWERPC_MPC512x_H__
> +#define __ASM_POWERPC_MPC512x_H__
> +
> +extern unsigned long mpc512x_find_ips_freq(struct device_node *node);
> +
> +#endif /* __ASM_POWERPC_MPC512x_H__ */
> +
> --
> 1.5.3.5.726.g41a7a
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev at ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>


-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.



More information about the Linuxppc-dev mailing list