From: Dirk Behme <dirk.behme@de.bosch.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/5] imx-common: Factor out get_ahb_clk()
Date: Thu, 26 Apr 2012 08:04:48 +0200 [thread overview]
Message-ID: <4F98E580.6090809@de.bosch.com> (raw)
In-Reply-To: <1332279610-22838-2-git-send-email-fabio.estevam@freescale.com>
Hi Fabio,
On 20.03.2012 22:40, Fabio Estevam wrote:
> get_ahb_clk() is a common function between mx5 and mx6.
>
> Place it into imx-common directory.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> arch/arm/cpu/armv7/imx-common/cpu.c | 23 ++++++++++++++++++++
> arch/arm/cpu/armv7/mx5/clock.c | 17 +-------------
> arch/arm/cpu/armv7/mx6/clock.c | 17 ++------------
> arch/arm/include/asm/arch-mx5/sys_proto.h | 1 +
> .../asm/arch-mx6/{ccm_regs.h => crm_regs.h} | 2 +-
> arch/arm/include/asm/arch-mx6/sys_proto.h | 1 +
> 6 files changed, 30 insertions(+), 31 deletions(-)
> rename arch/arm/include/asm/arch-mx6/{ccm_regs.h => crm_regs.h} (99%)
We had this patch on a v2012.04.1 based test branch and it showed some
strange issues with SD cards on i.MX6.
Depending on the SD card used (different ones) and the board (SabreLite
and a custom one)
- the SD card just works fine as we are used to
- booting fails with "MMC init failed"
- booting fails with "Card did not respond to voltage select!"
Reverting this patch on the test branch makes all tested boards and
tested SD cards work fine again.
I haven't looked into the details to debug the root cause, though.
So for the moment: NACK
Best regards
Dirk
> diff --git a/arch/arm/cpu/armv7/imx-common/cpu.c b/arch/arm/cpu/armv7/imx-common/cpu.c
> index 6d7486b..62b01e7 100644
> --- a/arch/arm/cpu/armv7/imx-common/cpu.c
> +++ b/arch/arm/cpu/armv7/imx-common/cpu.c
> @@ -29,6 +29,7 @@
> #include <asm/arch/imx-regs.h>
> #include <asm/arch/clock.h>
> #include <asm/arch/sys_proto.h>
> +#include <asm/arch/crm_regs.h>
>
> #ifdef CONFIG_FSL_ESDHC
> #include <fsl_esdhc.h>
> @@ -107,3 +108,25 @@ void reset_cpu(ulong addr)
> {
> __raw_writew(4, WDOG1_BASE_ADDR);
> }
> +
> +static u32 __get_periph_clk(void)
> +{
> + return 0; /* clock.c will override it */
> +}
> +
> +u32 get_periph_clk(void)
> + __attribute__((weak, alias("__get_periph_clk")));
> +
> +u32 get_ahb_clk(void)
> +{
> + struct mxc_ccm_reg *imx_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
> + u32 reg, ahb_podf;
> +
> + reg = __raw_readl(&imx_ccm->cbcdr);
> + reg &= MXC_CCM_CBCDR_AHB_PODF_MASK;
> + ahb_podf = reg >> MXC_CCM_CBCDR_AHB_PODF_OFFSET;
> +
> + return get_periph_clk() / (ahb_podf + 1);
> +
> + return 0;
> +}
> diff --git a/arch/arm/cpu/armv7/mx5/clock.c b/arch/arm/cpu/armv7/mx5/clock.c
> index e92f106..a1c8411 100644
> --- a/arch/arm/cpu/armv7/mx5/clock.c
> +++ b/arch/arm/cpu/armv7/mx5/clock.c
> @@ -30,6 +30,7 @@
> #include <asm/arch/crm_regs.h>
> #include <asm/arch/clock.h>
> #include <div64.h>
> +#include <asm/arch/sys_proto.h>
>
> enum pll_clocks {
> PLL1_CLOCK = 0,
> @@ -213,22 +214,6 @@ static u32 get_periph_clk(void)
> }
>
> /*
> - * Get the rate of ahb clock.
> - */
> -static u32 get_ahb_clk(void)
> -{
> - uint32_t freq, div, reg;
> -
> - freq = get_periph_clk();
> -
> - reg = __raw_readl(&mxc_ccm->cbcdr);
> - div = ((reg & MXC_CCM_CBCDR_AHB_PODF_MASK) >>
> - MXC_CCM_CBCDR_AHB_PODF_OFFSET) + 1;
> -
> - return freq / div;
> -}
> -
> -/*
> * Get the rate of ipg clock.
> */
> static u32 get_ipg_clk(void)
> diff --git a/arch/arm/cpu/armv7/mx6/clock.c b/arch/arm/cpu/armv7/mx6/clock.c
> index ef98563..5d42051 100644
> --- a/arch/arm/cpu/armv7/mx6/clock.c
> +++ b/arch/arm/cpu/armv7/mx6/clock.c
> @@ -24,8 +24,9 @@
> #include <asm/io.h>
> #include <asm/errno.h>
> #include <asm/arch/imx-regs.h>
> -#include <asm/arch/ccm_regs.h>
> +#include <asm/arch/crm_regs.h>
> #include <asm/arch/clock.h>
> +#include <asm/arch/sys_proto.h>
>
> enum pll_clocks {
> PLL_SYS, /* System PLL */
> @@ -34,7 +35,7 @@ enum pll_clocks {
> PLL_ENET, /* ENET PLL */
> };
>
> -struct imx_ccm_reg *imx_ccm = (struct imx_ccm_reg *)CCM_BASE_ADDR;
> +struct mxc_ccm_reg *imx_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
>
> void enable_usboh3_clk(unsigned char enable)
> {
> @@ -139,18 +140,6 @@ static u32 get_periph_clk(void)
> return freq;
> }
>
> -
> -static u32 get_ahb_clk(void)
> -{
> - u32 reg, ahb_podf;
> -
> - reg = __raw_readl(&imx_ccm->cbcdr);
> - reg &= MXC_CCM_CBCDR_AHB_PODF_MASK;
> - ahb_podf = reg >> MXC_CCM_CBCDR_AHB_PODF_OFFSET;
> -
> - return get_periph_clk() / (ahb_podf + 1);
> -}
> -
> static u32 get_ipg_clk(void)
> {
> u32 reg, ipg_podf;
> diff --git a/arch/arm/include/asm/arch-mx5/sys_proto.h b/arch/arm/include/asm/arch-mx5/sys_proto.h
> index 13d12ee..7250059 100644
> --- a/arch/arm/include/asm/arch-mx5/sys_proto.h
> +++ b/arch/arm/include/asm/arch-mx5/sys_proto.h
> @@ -35,5 +35,6 @@ void set_chipselect_size(int const);
> */
>
> int fecmxc_initialize(bd_t *bis);
> +u32 get_ahb_clk(void);
>
> #endif
> diff --git a/arch/arm/include/asm/arch-mx6/ccm_regs.h b/arch/arm/include/asm/arch-mx6/crm_regs.h
> similarity index 99%
> rename from arch/arm/include/asm/arch-mx6/ccm_regs.h
> rename to arch/arm/include/asm/arch-mx6/crm_regs.h
> index 4af0b90..0e605c2 100644
> --- a/arch/arm/include/asm/arch-mx6/ccm_regs.h
> +++ b/arch/arm/include/asm/arch-mx6/crm_regs.h
> @@ -20,7 +20,7 @@
> #ifndef __ARCH_ARM_MACH_MX6_CCM_REGS_H__
> #define __ARCH_ARM_MACH_MX6_CCM_REGS_H__
>
> -struct imx_ccm_reg {
> +struct mxc_ccm_reg {
> u32 ccr; /* 0x0000 */
> u32 ccdr;
> u32 csr;
> diff --git a/arch/arm/include/asm/arch-mx6/sys_proto.h b/arch/arm/include/asm/arch-mx6/sys_proto.h
> index 668e77a..3bfc69c 100644
> --- a/arch/arm/include/asm/arch-mx6/sys_proto.h
> +++ b/arch/arm/include/asm/arch-mx6/sys_proto.h
> @@ -34,5 +34,6 @@ u32 get_cpu_rev(void);
> */
>
> int fecmxc_initialize(bd_t *bis);
> +u32 get_ahb_clk(void);
>
> #endif
next prev parent reply other threads:[~2012-04-26 6:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-20 21:40 [U-Boot] [PATCH 1/5] pmic: Add support for the Dialog DA9053 PMIC Fabio Estevam
2012-03-20 21:40 ` [U-Boot] [PATCH 2/5] imx-common: Factor out get_ahb_clk() Fabio Estevam
2012-04-26 6:04 ` Dirk Behme [this message]
2012-04-29 14:54 ` Fabio Estevam
2012-04-29 16:26 ` Fabio Estevam
2012-04-29 18:15 ` Fabio Estevam
2012-05-06 16:33 ` Fabio Estevam
2012-04-29 16:43 ` Dirk Behme
2012-04-29 16:46 ` Stefano Babic
2012-04-29 18:11 ` [U-Boot] [PATCH v2] " Fabio Estevam
2012-05-08 7:04 ` Dirk Behme
2012-03-20 21:40 ` [U-Boot] [PATCH 3/5] mx5: Add clock config interface Fabio Estevam
2012-04-03 22:13 ` Fabio Estevam
2012-04-04 7:46 ` Stefano Babic
2012-03-20 21:40 ` [U-Boot] [PATCH 4/5] mx53loco: Allow to print CPU information at a later stage Fabio Estevam
2012-03-20 21:40 ` [U-Boot] [PATCH 5/5] mx53loco: Add support for 1GHz operation for DA9053-based boards Fabio Estevam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F98E580.6090809@de.bosch.com \
--to=dirk.behme@de.bosch.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.