All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] imx: mx6 remove duplicated enable_cspi_clock
@ 2015-06-24 10:44 Peng Fan
  2015-06-24 10:44 ` [U-Boot] [PATCH 2/3] imx: cm_fx6 use enable_spi_clk Peng Fan
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Peng Fan @ 2015-06-24 10:44 UTC (permalink / raw)
  To: u-boot

enable_spi_clock does the same thing with enable_cspi_clock.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
---
 arch/arm/cpu/armv7/mx6/clock.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx6/clock.c b/arch/arm/cpu/armv7/mx6/clock.c
index ae99945..1134770 100644
--- a/arch/arm/cpu/armv7/mx6/clock.c
+++ b/arch/arm/cpu/armv7/mx6/clock.c
@@ -102,25 +102,6 @@ void enable_uart_clk(unsigned char enable)
 }
 #endif
 
-#ifdef CONFIG_SPI
-/* spi_num can be from 0 - 4 */
-int enable_cspi_clock(unsigned char enable, unsigned spi_num)
-{
-	u32 mask;
-
-	if (spi_num > 4)
-		return -EINVAL;
-
-	mask = MXC_CCM_CCGR_CG_MASK << (spi_num * 2);
-	if (enable)
-		setbits_le32(&imx_ccm->CCGR1, mask);
-	else
-		clrbits_le32(&imx_ccm->CCGR1, mask);
-
-	return 0;
-}
-#endif
-
 #ifdef CONFIG_MMC
 int enable_usdhc_clk(unsigned char enable, unsigned bus_num)
 {
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 2/3] imx: cm_fx6 use enable_spi_clk
  2015-06-24 10:44 [U-Boot] [PATCH 1/3] imx: mx6 remove duplicated enable_cspi_clock Peng Fan
@ 2015-06-24 10:44 ` Peng Fan
  2015-06-24 10:44 ` [U-Boot] [PATCH 3/3] imx: mx6 add i2c4 clock support for i.MX6SX Peng Fan
  2015-06-24 15:53 ` [U-Boot] [PATCH 1/3] imx: mx6 remove duplicated enable_cspi_clock Fabio Estevam
  2 siblings, 0 replies; 5+ messages in thread
From: Peng Fan @ 2015-06-24 10:44 UTC (permalink / raw)
  To: u-boot

Use enable_spi_clock, since enable_cspi_clock is removed.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
---
 board/compulab/cm_fx6/spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/compulab/cm_fx6/spl.c b/board/compulab/cm_fx6/spl.c
index 5b4b76f..5ce33d0 100644
--- a/board/compulab/cm_fx6/spl.c
+++ b/board/compulab/cm_fx6/spl.c
@@ -303,7 +303,7 @@ static void cm_fx6_setup_uart(void)
 static void cm_fx6_setup_ecspi(void)
 {
 	cm_fx6_set_ecspi_iomux();
-	enable_cspi_clock(1, 0);
+	enable_spi_clock(1, 0);
 }
 #else
 static void cm_fx6_setup_ecspi(void) { }
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 3/3] imx: mx6 add i2c4 clock support for i.MX6SX
  2015-06-24 10:44 [U-Boot] [PATCH 1/3] imx: mx6 remove duplicated enable_cspi_clock Peng Fan
  2015-06-24 10:44 ` [U-Boot] [PATCH 2/3] imx: cm_fx6 use enable_spi_clk Peng Fan
@ 2015-06-24 10:44 ` Peng Fan
  2015-06-24 15:53 ` [U-Boot] [PATCH 1/3] imx: mx6 remove duplicated enable_cspi_clock Fabio Estevam
  2 siblings, 0 replies; 5+ messages in thread
From: Peng Fan @ 2015-06-24 10:44 UTC (permalink / raw)
  To: u-boot

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
we will get compliation failure for other platforms.

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>
---
 arch/arm/cpu/armv7/mx6/clock.c           | 14 ++++++++++----
 arch/arm/include/asm/arch-mx6/crm_regs.h |  9 ++++-----
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx6/clock.c b/arch/arm/cpu/armv7/mx6/clock.c
index 1134770..b461898 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 887d048..ce9ac21 100644
--- a/arch/arm/include/asm/arch-mx6/crm_regs.h
+++ b/arch/arm/include/asm/arch-mx6/crm_regs.h
@@ -740,7 +740,10 @@ 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 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)
+/* The following 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
@@ -755,10 +758,6 @@ 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
-#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
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 1/3] imx: mx6 remove duplicated enable_cspi_clock
  2015-06-24 10:44 [U-Boot] [PATCH 1/3] imx: mx6 remove duplicated enable_cspi_clock Peng Fan
  2015-06-24 10:44 ` [U-Boot] [PATCH 2/3] imx: cm_fx6 use enable_spi_clk Peng Fan
  2015-06-24 10:44 ` [U-Boot] [PATCH 3/3] imx: mx6 add i2c4 clock support for i.MX6SX Peng Fan
@ 2015-06-24 15:53 ` Fabio Estevam
  2015-06-25  1:10   ` Peng Fan
  2 siblings, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2015-06-24 15:53 UTC (permalink / raw)
  To: u-boot

On Wed, Jun 24, 2015 at 7:44 AM, Peng Fan <Peng.Fan@freescale.com> wrote:
> enable_spi_clock does the same thing with enable_cspi_clock.
>
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> ---
>  arch/arm/cpu/armv7/mx6/clock.c | 19 -------------------
>  1 file changed, 19 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/mx6/clock.c b/arch/arm/cpu/armv7/mx6/clock.c
> index ae99945..1134770 100644
> --- a/arch/arm/cpu/armv7/mx6/clock.c
> +++ b/arch/arm/cpu/armv7/mx6/clock.c
> @@ -102,25 +102,6 @@ void enable_uart_clk(unsigned char enable)
>  }
>  #endif
>
> -#ifdef CONFIG_SPI
> -/* spi_num can be from 0 - 4 */
> -int enable_cspi_clock(unsigned char enable, unsigned spi_num)
> -{
> -       u32 mask;
> -
> -       if (spi_num > 4)
> -               return -EINVAL;
> -
> -       mask = MXC_CCM_CCGR_CG_MASK << (spi_num * 2);
> -       if (enable)
> -               setbits_le32(&imx_ccm->CCGR1, mask);
> -       else
> -               clrbits_le32(&imx_ccm->CCGR1, mask);
> -
> -       return 0;
> -}
> -#endif
> -

This patch causes board/compulab/cm_fx6/spl.c to fail to build.

I see that you fix board/compulab/cm_fx6/spl.c in a later patch in
your series, but it should be part of the same patch to avoid the
build breakage.

You should also remove the function prototype from
arch/arm/include/asm/arch-mx6/clock.h.

Regards,

Fabio Estevam

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 1/3] imx: mx6 remove duplicated enable_cspi_clock
  2015-06-24 15:53 ` [U-Boot] [PATCH 1/3] imx: mx6 remove duplicated enable_cspi_clock Fabio Estevam
@ 2015-06-25  1:10   ` Peng Fan
  0 siblings, 0 replies; 5+ messages in thread
From: Peng Fan @ 2015-06-25  1:10 UTC (permalink / raw)
  To: u-boot

On Wed, Jun 24, 2015 at 12:53:40PM -0300, Fabio Estevam wrote:
>On Wed, Jun 24, 2015 at 7:44 AM, Peng Fan <Peng.Fan@freescale.com> wrote:
>> enable_spi_clock does the same thing with enable_cspi_clock.
>>
>> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
>> ---
>>  arch/arm/cpu/armv7/mx6/clock.c | 19 -------------------
>>  1 file changed, 19 deletions(-)
>>
>> diff --git a/arch/arm/cpu/armv7/mx6/clock.c b/arch/arm/cpu/armv7/mx6/clock.c
>> index ae99945..1134770 100644
>> --- a/arch/arm/cpu/armv7/mx6/clock.c
>> +++ b/arch/arm/cpu/armv7/mx6/clock.c
>> @@ -102,25 +102,6 @@ void enable_uart_clk(unsigned char enable)
>>  }
>>  #endif
>>
>> -#ifdef CONFIG_SPI
>> -/* spi_num can be from 0 - 4 */
>> -int enable_cspi_clock(unsigned char enable, unsigned spi_num)
>> -{
>> -       u32 mask;
>> -
>> -       if (spi_num > 4)
>> -               return -EINVAL;
>> -
>> -       mask = MXC_CCM_CCGR_CG_MASK << (spi_num * 2);
>> -       if (enable)
>> -               setbits_le32(&imx_ccm->CCGR1, mask);
>> -       else
>> -               clrbits_le32(&imx_ccm->CCGR1, mask);
>> -
>> -       return 0;
>> -}
>> -#endif
>> -
>
>This patch causes board/compulab/cm_fx6/spl.c to fail to build.
>
>I see that you fix board/compulab/cm_fx6/spl.c in a later patch in
>your series, but it should be part of the same patch to avoid the
>build breakage.
>
I thought board and arch code should not be in one patch,
so I splitted it into two patch. Will fix it in v2.
>You should also remove the function prototype from
>arch/arm/include/asm/arch-mx6/clock.h.
Thanks for pointing this out. Will fix in v2.
>
>Regards,
>
>Fabio Estevam

Thanks,
Peng
-- 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-06-25  1:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-24 10:44 [U-Boot] [PATCH 1/3] imx: mx6 remove duplicated enable_cspi_clock Peng Fan
2015-06-24 10:44 ` [U-Boot] [PATCH 2/3] imx: cm_fx6 use enable_spi_clk Peng Fan
2015-06-24 10:44 ` [U-Boot] [PATCH 3/3] imx: mx6 add i2c4 clock support for i.MX6SX Peng Fan
2015-06-24 15:53 ` [U-Boot] [PATCH 1/3] imx: mx6 remove duplicated enable_cspi_clock Fabio Estevam
2015-06-25  1:10   ` Peng Fan

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.