From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2 2/2] imx: mx6 add i2c4 clock support for i.MX6SX
Date: Fri, 10 Jul 2015 09:37:38 +0200 [thread overview]
Message-ID: <559F7642.7050003@denx.de> (raw)
In-Reply-To: <1435741310-20022-2-git-send-email-Peng.Fan@freescale.com>
On 01/07/2015 11:01, Peng Fan wrote:
> Add I2C4 clock support for i.MX6SX. Since we use runtime check,
> but not macro, we need to remove `#ifdef ..` in crm_regs.h, or
> gcc will fail to compile the code succesfully.
>
> Making the macros only for i.MX6SX open to other i.MX6x maybe not
> a good choice, but we have runtime check.
>
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> ---
>
> Changes v2:
> correct spelling error in commit log.
>
> arch/arm/cpu/armv7/mx6/clock.c | 14 ++++++++++----
> arch/arm/include/asm/arch-mx6/crm_regs.h | 5 ++---
> 2 files changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/mx6/clock.c b/arch/arm/cpu/armv7/mx6/clock.c
> index 7bd78d7..3e94472 100644
> --- a/arch/arm/cpu/armv7/mx6/clock.c
> +++ b/arch/arm/cpu/armv7/mx6/clock.c
> @@ -126,6 +126,7 @@ int enable_i2c_clk(unsigned char enable, unsigned i2c_num)
> {
> u32 reg;
> u32 mask;
> + u32 *addr;
>
> if (i2c_num > 3)
> return -EINVAL;
> @@ -140,14 +141,19 @@ int enable_i2c_clk(unsigned char enable, unsigned i2c_num)
> reg &= ~mask;
> __raw_writel(reg, &imx_ccm->CCGR2);
> } else {
> - mask = MXC_CCM_CCGR_CG_MASK
> - << (MXC_CCM_CCGR1_I2C4_SERIAL_OFFSET);
> - reg = __raw_readl(&imx_ccm->CCGR1);
> + if (is_cpu_type(MXC_CPU_MX6SX)) {
> + mask = MXC_CCM_CCGR6_I2C4_MASK;
> + addr = &imx_ccm->CCGR6;
> + } else {
> + mask = MXC_CCM_CCGR1_I2C4_SERIAL_MASK;
> + addr = &imx_ccm->CCGR1;
> + }
> + reg = __raw_readl(addr);
> if (enable)
> reg |= mask;
> else
> reg &= ~mask;
> - __raw_writel(reg, &imx_ccm->CCGR1);
> + __raw_writel(reg, addr);
> }
> return 0;
> }
> diff --git a/arch/arm/include/asm/arch-mx6/crm_regs.h b/arch/arm/include/asm/arch-mx6/crm_regs.h
> index 5bbf6e0..7d9fe73 100644
> --- a/arch/arm/include/asm/arch-mx6/crm_regs.h
> +++ b/arch/arm/include/asm/arch-mx6/crm_regs.h
> @@ -742,7 +742,7 @@ struct mxc_ccm_reg {
> #define MXC_CCM_CCGR6_USDHC4_MASK (3 << MXC_CCM_CCGR6_USDHC4_OFFSET)
> #define MXC_CCM_CCGR6_EMI_SLOW_OFFSET 10
> #define MXC_CCM_CCGR6_EMI_SLOW_MASK (3 << MXC_CCM_CCGR6_EMI_SLOW_OFFSET)
> -#ifdef CONFIG_MX6SX
> +/* The following *CCGR6* exist only i.MX6SX */
> #define MXC_CCM_CCGR6_PWM8_OFFSET 16
> #define MXC_CCM_CCGR6_PWM8_MASK (3 << MXC_CCM_CCGR6_PWM8_OFFSET)
> #define MXC_CCM_CCGR6_VADC_OFFSET 20
> @@ -757,10 +757,9 @@ struct mxc_ccm_reg {
> #define MXC_CCM_CCGR6_PWM6_MASK (3 << MXC_CCM_CCGR6_PWM6_OFFSET)
> #define MXC_CCM_CCGR6_PWM7_OFFSET 30
> #define MXC_CCM_CCGR6_PWM7_MASK (3 << MXC_CCM_CCGR6_PWM7_OFFSET)
> -#else
> +/* The two does not exist on i.MX6SX */
> #define MXC_CCM_CCGR6_VDOAXICLK_OFFSET 12
> #define MXC_CCM_CCGR6_VDOAXICLK_MASK (3 << MXC_CCM_CCGR6_VDOAXICLK_OFFSET)
> -#endif
>
> #define BM_ANADIG_PLL_SYS_LOCK 0x80000000
> #define BP_ANADIG_PLL_SYS_RSVD0 20
>
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
next prev parent reply other threads:[~2015-07-10 7:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-01 9:01 [U-Boot] [PATCH V2 1/2] imx: mx6 remove duplicated enable_cspi_clock Peng Fan
2015-07-01 9:01 ` [U-Boot] [PATCH V2 2/2] imx: mx6 add i2c4 clock support for i.MX6SX Peng Fan
2015-07-10 7:37 ` Stefano Babic [this message]
2015-07-10 7:37 ` [U-Boot] [PATCH V2 1/2] imx: mx6 remove duplicated enable_cspi_clock Stefano Babic
-- strict thread matches above, loose matches on Subject: below --
2015-06-25 1:33 Peng Fan
2015-06-25 1:33 ` [U-Boot] [PATCH V2 2/2] imx: mx6 add i2c4 clock support for i.MX6SX Peng Fan
2015-06-28 8:52 ` Stefano Babic
2015-06-29 1:33 ` Peng Fan
2015-06-29 7:13 ` Stefano Babic
2015-06-29 7:29 ` Peng Fan
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=559F7642.7050003@denx.de \
--to=sbabic@denx.de \
--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.