[PATCH 14/23] net fec: Switch to clk support

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Wed Sep 26 12:07:46 EDT 2012


On 13:04 Mon 24 Sep     , Sascha Hauer wrote:
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> ---
>  drivers/net/fec_imx.c |   27 ++++++++++++++++++++++++---
>  drivers/net/fec_imx.h |    1 +
>  2 files changed, 25 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
> index 6acf6bd..4606558 100644
> --- a/drivers/net/fec_imx.c
> +++ b/drivers/net/fec_imx.c
> @@ -24,6 +24,8 @@
>  #include <clock.h>
>  #include <xfuncs.h>
>  #include <linux/phy.h>
> +#include <linux/clk.h>
> +#include <linux/err.h>
>  
>  #include <asm/mmu.h>
>  
> @@ -43,6 +45,19 @@ struct fec_frame {
>  	uint8_t head[16];	/* MAC header(6 + 6 + 2) + 2(aligned) */
>  };
>  
> +#ifdef CONFIG_COMMON_CLK
> +static inline unsigned long fec_clk_get_rate(struct fec_priv *fec)
> +{
> +	return clk_get_rate(fec->clk);
> +}
> +#else
> +static inline unsigned long fec_clk_get_rate(struct fec_priv *fec)
> +{
> +	return imx_get_fecclk();
> +}
> +#endif
> +
> +
>  /*
>   * MII-interface related functions
>   */
> @@ -54,7 +69,7 @@ static int fec_miibus_read(struct mii_bus *bus, int phyAddr, int regAddr)
>  	uint32_t phy;		/* convenient holder for the PHY */
>  	uint64_t start;
>  
> -	writel(((imx_get_fecclk() >> 20) / 5) << 1,
> +	writel(((fec_clk_get_rate(fec) >> 20) / 5) << 1,
is the rate changing?

if not put it in the fec will reduce the number function call

Best Regards,
J.



More information about the barebox mailing list