public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/7] mx25: Fix decode_pll
@ 2012-09-27 20:26 Benoît Thébaudeau
  2012-09-27 20:27 ` [U-Boot] [PATCH 2/7] mx25: Clean up clock calculations Benoît Thébaudeau
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Benoît Thébaudeau @ 2012-09-27 20:26 UTC (permalink / raw)
  To: u-boot

The MFN bit-field of the PLL registers represents a signed value. See the
reference manual.

Signed-off-by: Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 .../arch/arm/cpu/arm926ejs/mx25/generic.c          |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git u-boot-imx-e1eb75b.orig/arch/arm/cpu/arm926ejs/mx25/generic.c u-boot-imx-e1eb75b/arch/arm/cpu/arm926ejs/mx25/generic.c
index 90e584a..2283a89 100644
--- u-boot-imx-e1eb75b.orig/arch/arm/cpu/arm926ejs/mx25/generic.c
+++ u-boot-imx-e1eb75b/arch/arm/cpu/arm926ejs/mx25/generic.c
@@ -48,7 +48,7 @@ static unsigned int imx_decode_pll(unsigned int pll, unsigned int f_ref)
 {
 	unsigned int mfi = (pll >> CCM_PLL_MFI_SHIFT)
 	    & CCM_PLL_MFI_MASK;
-	unsigned int mfn = (pll >> CCM_PLL_MFN_SHIFT)
+	int mfn = (pll >> CCM_PLL_MFN_SHIFT)
 	    & CCM_PLL_MFN_MASK;
 	unsigned int mfd = (pll >> CCM_PLL_MFD_SHIFT)
 	    & CCM_PLL_MFD_MASK;
@@ -56,9 +56,12 @@ static unsigned int imx_decode_pll(unsigned int pll, unsigned int f_ref)
 	    & CCM_PLL_PD_MASK;
 
 	mfi = mfi <= 5 ? 5 : mfi;
+	mfn = mfn >= 512 ? mfn - 1024 : mfn;
+	mfd += 1;
+	pd += 1;
 
-	return lldiv(2 * (u64) f_ref * (mfi * (mfd + 1) + mfn),
-		      (mfd + 1) * (pd + 1));
+	return lldiv(2 * (u64) f_ref * (mfi * mfd + mfn),
+		     mfd * pd);
 }
 
 static ulong imx_get_mpllclk(void)

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

* [U-Boot] [PATCH 2/7] mx25: Clean up clock calculations
  2012-09-27 20:26 [U-Boot] [PATCH 1/7] mx25: Fix decode_pll Benoît Thébaudeau
@ 2012-09-27 20:27 ` Benoît Thébaudeau
  2012-09-27 20:27 ` [U-Boot] [PATCH 3/7] mx25: Define more standard clocks Benoît Thébaudeau
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Benoît Thébaudeau @ 2012-09-27 20:27 UTC (permalink / raw)
  To: u-boot

Avoid possible overflow in clock calculations, and do not waste calls to lldiv()
to divide simple ulongs.

Signed-off-by: Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 .../arch/arm/cpu/arm926ejs/mx25/generic.c          |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git u-boot-imx-e1eb75b.orig/arch/arm/cpu/arm926ejs/mx25/generic.c u-boot-imx-e1eb75b/arch/arm/cpu/arm926ejs/mx25/generic.c
index 2283a89..5503522 100644
--- u-boot-imx-e1eb75b.orig/arch/arm/cpu/arm926ejs/mx25/generic.c
+++ u-boot-imx-e1eb75b/arch/arm/cpu/arm926ejs/mx25/generic.c
@@ -80,12 +80,12 @@ ulong imx_get_armclk(void)
 	ulong div;
 
 	if (cctl & CCM_CCTL_ARM_SRC)
-		fref = lldiv((fref * 3), 4);
+		fref = lldiv((u64) fref * 3, 4);
 
 	div = ((cctl >> CCM_CCTL_ARM_DIV_SHIFT)
 	       & CCM_CCTL_ARM_DIV_MASK) + 1;
 
-	return lldiv(fref, div);
+	return fref / div;
 }
 
 ulong imx_get_ahbclk(void)
@@ -98,7 +98,7 @@ ulong imx_get_ahbclk(void)
 	div = ((cctl >> CCM_CCTL_AHB_DIV_SHIFT)
 	       & CCM_CCTL_AHB_DIV_MASK) + 1;
 
-	return lldiv(fref, div);
+	return fref / div;
 }
 
 ulong imx_get_perclk(int clk)
@@ -110,7 +110,7 @@ ulong imx_get_perclk(int clk)
 	div = readl(&ccm->pcdr[CCM_PERCLK_REG(clk)]);
 	div = ((div >> CCM_PERCLK_SHIFT(clk)) & CCM_PERCLK_MASK) + 1;
 
-	return lldiv(fref, div);
+	return fref / div;
 }
 
 unsigned int mxc_get_clock(enum mxc_clock clk)

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

* [U-Boot] [PATCH 3/7] mx25: Define more standard clocks
  2012-09-27 20:26 [U-Boot] [PATCH 1/7] mx25: Fix decode_pll Benoît Thébaudeau
  2012-09-27 20:27 ` [U-Boot] [PATCH 2/7] mx25: Clean up clock calculations Benoît Thébaudeau
@ 2012-09-27 20:27 ` Benoît Thébaudeau
  2012-09-27 20:27 ` [U-Boot] [PATCH 4/7] mx25 clocks: Fix MXC_FEC_CLK Benoît Thébaudeau
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Benoît Thébaudeau @ 2012-09-27 20:27 UTC (permalink / raw)
  To: u-boot

Define AHB, IPG and CSPI clocks.

Signed-off-by: Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 .../arch/arm/cpu/arm926ejs/mx25/generic.c          |   10 ++++++++++
 .../arch/arm/include/asm/arch-mx25/clock.h         |    5 +++++
 2 files changed, 15 insertions(+)

diff --git u-boot-imx-e1eb75b.orig/arch/arm/cpu/arm926ejs/mx25/generic.c u-boot-imx-e1eb75b/arch/arm/cpu/arm926ejs/mx25/generic.c
index 5503522..219c9eb 100644
--- u-boot-imx-e1eb75b.orig/arch/arm/cpu/arm926ejs/mx25/generic.c
+++ u-boot-imx-e1eb75b/arch/arm/cpu/arm926ejs/mx25/generic.c
@@ -101,6 +101,11 @@ ulong imx_get_ahbclk(void)
 	return fref / div;
 }
 
+static ulong imx_get_ipgclk(void)
+{
+	return imx_get_ahbclk() / 2;
+}
+
 ulong imx_get_perclk(int clk)
 {
 	struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE;
@@ -120,6 +125,11 @@ unsigned int mxc_get_clock(enum mxc_clock clk)
 	switch (clk) {
 	case MXC_ARM_CLK:
 		return imx_get_armclk();
+	case MXC_AHB_CLK:
+		return imx_get_ahbclk();
+	case MXC_IPG_CLK:
+	case MXC_CSPI_CLK:
+		return imx_get_ipgclk();
 	case MXC_FEC_CLK:
 		return imx_get_ahbclk();
 	default:
diff --git u-boot-imx-e1eb75b.orig/arch/arm/include/asm/arch-mx25/clock.h u-boot-imx-e1eb75b/arch/arm/include/asm/arch-mx25/clock.h
index a313b80..9823f46 100644
--- u-boot-imx-e1eb75b.orig/arch/arm/include/asm/arch-mx25/clock.h
+++ u-boot-imx-e1eb75b/arch/arm/include/asm/arch-mx25/clock.h
@@ -41,6 +41,7 @@
 #endif
 
 enum mxc_clock {
+	/* PER clocks (do not change order) */
 	MXC_CSI_CLK,
 	MXC_EPIT_CLK,
 	MXC_ESAI_CLK,
@@ -57,7 +58,11 @@ enum mxc_clock {
 	MXC_SSI1_CLK,
 	MXC_SSI2_CLK,
 	MXC_UART_CLK,
+	/* Other clocks */
 	MXC_ARM_CLK,
+	MXC_AHB_CLK,
+	MXC_IPG_CLK,
+	MXC_CSPI_CLK,
 	MXC_FEC_CLK,
 	MXC_CLK_NUM
 };

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

* [U-Boot] [PATCH 4/7] mx25 clocks: Fix MXC_FEC_CLK
  2012-09-27 20:26 [U-Boot] [PATCH 1/7] mx25: Fix decode_pll Benoît Thébaudeau
  2012-09-27 20:27 ` [U-Boot] [PATCH 2/7] mx25: Clean up clock calculations Benoît Thébaudeau
  2012-09-27 20:27 ` [U-Boot] [PATCH 3/7] mx25: Define more standard clocks Benoît Thébaudeau
@ 2012-09-27 20:27 ` Benoît Thébaudeau
  2012-09-28 10:33   ` Stefano Babic
  2012-09-27 20:27 ` [U-Boot] [PATCH 5/7] mx25: Clean up clocks API Benoît Thébaudeau
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Benoît Thébaudeau @ 2012-09-27 20:27 UTC (permalink / raw)
  To: u-boot

mxc_get_clock(MXC_FEC_CLK) should return the IPG clock, not the AHB clock.

Also, imx_get_fecclk() was correct but reimplemented the calculation of the IPG
clock, so remove the duplicated code.

Signed-off-by: Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 .../arch/arm/cpu/arm926ejs/mx25/generic.c          |    3 +--
 .../arch/arm/include/asm/arch-mx25/clock.h         |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git u-boot-imx-e1eb75b.orig/arch/arm/cpu/arm926ejs/mx25/generic.c u-boot-imx-e1eb75b/arch/arm/cpu/arm926ejs/mx25/generic.c
index 219c9eb..5879b18 100644
--- u-boot-imx-e1eb75b.orig/arch/arm/cpu/arm926ejs/mx25/generic.c
+++ u-boot-imx-e1eb75b/arch/arm/cpu/arm926ejs/mx25/generic.c
@@ -129,9 +129,8 @@ unsigned int mxc_get_clock(enum mxc_clock clk)
 		return imx_get_ahbclk();
 	case MXC_IPG_CLK:
 	case MXC_CSPI_CLK:
-		return imx_get_ipgclk();
 	case MXC_FEC_CLK:
-		return imx_get_ahbclk();
+		return imx_get_ipgclk();
 	default:
 		return imx_get_perclk(clk);
 	}
diff --git u-boot-imx-e1eb75b.orig/arch/arm/include/asm/arch-mx25/clock.h u-boot-imx-e1eb75b/arch/arm/include/asm/arch-mx25/clock.h
index 9823f46..a532da5 100644
--- u-boot-imx-e1eb75b.orig/arch/arm/include/asm/arch-mx25/clock.h
+++ u-boot-imx-e1eb75b/arch/arm/include/asm/arch-mx25/clock.h
@@ -71,7 +71,7 @@ ulong imx_get_perclk(int clk);
 ulong imx_get_ahbclk(void);
 
 #define imx_get_uartclk() imx_get_perclk(15)
-#define imx_get_fecclk() (imx_get_ahbclk()/2)
+#define imx_get_fecclk() mxc_get_clock(MXC_FEC_CLK)
 
 unsigned int mxc_get_clock(enum mxc_clock clk);
 

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

* [U-Boot] [PATCH 5/7] mx25: Clean up clocks API
  2012-09-27 20:26 [U-Boot] [PATCH 1/7] mx25: Fix decode_pll Benoît Thébaudeau
                   ` (2 preceding siblings ...)
  2012-09-27 20:27 ` [U-Boot] [PATCH 4/7] mx25 clocks: Fix MXC_FEC_CLK Benoît Thébaudeau
@ 2012-09-27 20:27 ` Benoît Thébaudeau
  2012-09-28 10:31   ` Stefano Babic
  2012-09-27 20:28 ` [U-Boot] [PATCH 6/7] mx25: Define cpu_eth_init() only if needed Benoît Thébaudeau
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Benoît Thébaudeau @ 2012-09-27 20:27 UTC (permalink / raw)
  To: u-boot

Use the standard mxc_get_clock() instead of exporting internal functions and
using literal constant values.

Signed-off-by: Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 .../arch/arm/cpu/arm926ejs/mx25/generic.c          |    6 +++---
 .../arch/arm/include/asm/arch-mx25/clock.h         |    9 +++------
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git u-boot-imx-e1eb75b.orig/arch/arm/cpu/arm926ejs/mx25/generic.c u-boot-imx-e1eb75b/arch/arm/cpu/arm926ejs/mx25/generic.c
index 5879b18..5da2582 100644
--- u-boot-imx-e1eb75b.orig/arch/arm/cpu/arm926ejs/mx25/generic.c
+++ u-boot-imx-e1eb75b/arch/arm/cpu/arm926ejs/mx25/generic.c
@@ -72,7 +72,7 @@ static ulong imx_get_mpllclk(void)
 	return imx_decode_pll(readl(&ccm->mpctl), fref);
 }
 
-ulong imx_get_armclk(void)
+static ulong imx_get_armclk(void)
 {
 	struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE;
 	ulong cctl = readl(&ccm->cctl);
@@ -88,7 +88,7 @@ ulong imx_get_armclk(void)
 	return fref / div;
 }
 
-ulong imx_get_ahbclk(void)
+static ulong imx_get_ahbclk(void)
 {
 	struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE;
 	ulong cctl = readl(&ccm->cctl);
@@ -106,7 +106,7 @@ static ulong imx_get_ipgclk(void)
 	return imx_get_ahbclk() / 2;
 }
 
-ulong imx_get_perclk(int clk)
+static ulong imx_get_perclk(int clk)
 {
 	struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE;
 	ulong fref = imx_get_ahbclk();
diff --git u-boot-imx-e1eb75b.orig/arch/arm/include/asm/arch-mx25/clock.h u-boot-imx-e1eb75b/arch/arm/include/asm/arch-mx25/clock.h
index a532da5..efbe038 100644
--- u-boot-imx-e1eb75b.orig/arch/arm/include/asm/arch-mx25/clock.h
+++ u-boot-imx-e1eb75b/arch/arm/include/asm/arch-mx25/clock.h
@@ -67,12 +67,9 @@ enum mxc_clock {
 	MXC_CLK_NUM
 };
 
-ulong imx_get_perclk(int clk);
-ulong imx_get_ahbclk(void);
-
-#define imx_get_uartclk() imx_get_perclk(15)
-#define imx_get_fecclk() mxc_get_clock(MXC_FEC_CLK)
-
 unsigned int mxc_get_clock(enum mxc_clock clk);
 
+#define imx_get_uartclk()	mxc_get_clock(MXC_UART_CLK)
+#define imx_get_fecclk()	mxc_get_clock(MXC_FEC_CLK)
+
 #endif /* __ASM_ARCH_CLOCK_H */

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

* [U-Boot] [PATCH 6/7] mx25: Define cpu_eth_init() only if needed
  2012-09-27 20:26 [U-Boot] [PATCH 1/7] mx25: Fix decode_pll Benoît Thébaudeau
                   ` (3 preceding siblings ...)
  2012-09-27 20:27 ` [U-Boot] [PATCH 5/7] mx25: Clean up clocks API Benoît Thébaudeau
@ 2012-09-27 20:28 ` Benoît Thébaudeau
  2012-09-27 20:55   ` Fabio Estevam
  2012-09-27 20:28 ` [U-Boot] [PATCH 7/7] mx25: Fix eSDHC support Benoît Thébaudeau
  2012-09-30 10:26 ` [U-Boot] [PATCH 1/7] mx25: Fix decode_pll Stefano Babic
  6 siblings, 1 reply; 13+ messages in thread
From: Benoît Thébaudeau @ 2012-09-27 20:28 UTC (permalink / raw)
  To: u-boot

The FEC is the only SoC Ethernet support available on i.MX25, so define
cpu_eth_init() only for it instead of returning a misleading success code.

Signed-off-by: Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 .../arch/arm/cpu/arm926ejs/mx25/generic.c          |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git u-boot-imx-e1eb75b.orig/arch/arm/cpu/arm926ejs/mx25/generic.c u-boot-imx-e1eb75b/arch/arm/cpu/arm926ejs/mx25/generic.c
index 5da2582..6374248 100644
--- u-boot-imx-e1eb75b.orig/arch/arm/cpu/arm926ejs/mx25/generic.c
+++ u-boot-imx-e1eb75b/arch/arm/cpu/arm926ejs/mx25/generic.c
@@ -206,9 +206,13 @@ void enable_caches(void)
 #endif
 }
 
+#if defined(CONFIG_FEC_MXC)
+/*
+ * Initializes on-chip ethernet controllers.
+ * to override, implement board_eth_init()
+ */
 int cpu_eth_init(bd_t *bis)
 {
-#if defined(CONFIG_FEC_MXC)
 	struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE;
 	ulong val;
 
@@ -216,10 +220,8 @@ int cpu_eth_init(bd_t *bis)
 	val |= (1 << 23);
 	writel(val, &ccm->cgr0);
 	return fecmxc_initialize(bis);
-#else
-	return 0;
-#endif
 }
+#endif
 
 int get_clocks(void)
 {

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

* [U-Boot] [PATCH 7/7] mx25: Fix eSDHC support
  2012-09-27 20:26 [U-Boot] [PATCH 1/7] mx25: Fix decode_pll Benoît Thébaudeau
                   ` (4 preceding siblings ...)
  2012-09-27 20:28 ` [U-Boot] [PATCH 6/7] mx25: Define cpu_eth_init() only if needed Benoît Thébaudeau
@ 2012-09-27 20:28 ` Benoît Thébaudeau
  2012-09-30 10:26 ` [U-Boot] [PATCH 1/7] mx25: Fix decode_pll Stefano Babic
  6 siblings, 0 replies; 13+ messages in thread
From: Benoît Thébaudeau @ 2012-09-27 20:28 UTC (permalink / raw)
  To: u-boot

The MMC driver appropriate for the i.MX25 is fsl_esdhc, which has nothing to do
with mxcmmc.

Also, each eSDHC instance has a dedicated clock, so gd->sdhc_clk must be set
accordingly. This is good for the case only a single SDHC instance is used
(initialization made with fsl_esdhc_mmc_init()). A future patch will fix the
multi-instance use case (initialization made directly with
fsl_esdhc_initialize()).

Signed-off-by: Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Eric B?nard <eric@eukrea.com>
Cc: Otavio Salvador <otavio@ossystems.com.br>
---
 .../arch/arm/cpu/arm926ejs/mx25/generic.c          |   19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git u-boot-imx-e1eb75b.orig/arch/arm/cpu/arm926ejs/mx25/generic.c u-boot-imx-e1eb75b/arch/arm/cpu/arm926ejs/mx25/generic.c
index 6374248..af81b33 100644
--- u-boot-imx-e1eb75b.orig/arch/arm/cpu/arm926ejs/mx25/generic.c
+++ u-boot-imx-e1eb75b/arch/arm/cpu/arm926ejs/mx25/generic.c
@@ -29,11 +29,10 @@
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/imx25-pinmux.h>
 #include <asm/arch/clock.h>
-#ifdef CONFIG_MXC_MMC
-#include <asm/arch/mxcmmc.h>
-#endif
 
 #ifdef CONFIG_FSL_ESDHC
+#include <fsl_esdhc.h>
+
 DECLARE_GLOBAL_DATA_PTR;
 #endif
 
@@ -226,23 +225,25 @@ int cpu_eth_init(bd_t *bis)
 int get_clocks(void)
 {
 #ifdef CONFIG_FSL_ESDHC
-	gd->sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
+#if CONFIG_SYS_FSL_ESDHC_ADDR == IMX_MMC_SDHC2_BASE
+	gd->sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
+#else
+	gd->sdhc_clk = mxc_get_clock(MXC_ESDHC1_CLK);
+#endif
 #endif
 	return 0;
 }
 
+#ifdef CONFIG_FSL_ESDHC
 /*
  * Initializes on-chip MMC controllers.
  * to override, implement board_mmc_init()
  */
 int cpu_mmc_init(bd_t *bis)
 {
-#ifdef CONFIG_MXC_MMC
-	return mxc_mmc_init(bis);
-#else
-	return 0;
-#endif
+	return fsl_esdhc_mmc_init(bis);
 }
+#endif
 
 #ifdef CONFIG_MXC_UART
 void mx25_uart1_init_pins(void)

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

* [U-Boot] [PATCH 6/7] mx25: Define cpu_eth_init() only if needed
  2012-09-27 20:28 ` [U-Boot] [PATCH 6/7] mx25: Define cpu_eth_init() only if needed Benoît Thébaudeau
@ 2012-09-27 20:55   ` Fabio Estevam
  2012-09-27 21:43     ` Benoît Thébaudeau
  0 siblings, 1 reply; 13+ messages in thread
From: Fabio Estevam @ 2012-09-27 20:55 UTC (permalink / raw)
  To: u-boot

Hi Beno?t,

On Thu, Sep 27, 2012 at 5:28 PM, Beno?t Th?baudeau
<benoit.thebaudeau@advansee.com> wrote:
> The FEC is the only SoC Ethernet support available on i.MX25, so define
> cpu_eth_init() only for it instead of returning a misleading success code.

Yes, but someone may want to use mx25 with a external LAN device (such
as LAN92xx) instead of FEC.

Regards,

Fabio Estevam

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

* [U-Boot] [PATCH 6/7] mx25: Define cpu_eth_init() only if needed
  2012-09-27 20:55   ` Fabio Estevam
@ 2012-09-27 21:43     ` Benoît Thébaudeau
  2012-09-28  9:09       ` Stefano Babic
  0 siblings, 1 reply; 13+ messages in thread
From: Benoît Thébaudeau @ 2012-09-27 21:43 UTC (permalink / raw)
  To: u-boot

Hi Fabio,

On Thursday, September 27, 2012 10:55:22 PM, Fabio Estevam wrote:
> Hi Beno?t,
> 
> On Thu, Sep 27, 2012 at 5:28 PM, Beno?t Th?baudeau
> <benoit.thebaudeau@advansee.com> wrote:
> > The FEC is the only SoC Ethernet support available on i.MX25, so
> > define
> > cpu_eth_init() only for it instead of returning a misleading
> > success code.
> 
> Yes, but someone may want to use mx25 with a external LAN device
> (such
> as LAN92xx) instead of FEC.

Yes, but in that case I think that there should be a board_eth_init() function
defined, so this patch won't cause any trouble here. See in
net/eth.c:eth_initialize() how these functions and their default implementations
are handled.

Best regards,
Beno?t

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

* [U-Boot] [PATCH 6/7] mx25: Define cpu_eth_init() only if needed
  2012-09-27 21:43     ` Benoît Thébaudeau
@ 2012-09-28  9:09       ` Stefano Babic
  0 siblings, 0 replies; 13+ messages in thread
From: Stefano Babic @ 2012-09-28  9:09 UTC (permalink / raw)
  To: u-boot

On 27/09/2012 23:43, Beno?t Th?baudeau wrote:
> Hi Fabio,
> 
> On Thursday, September 27, 2012 10:55:22 PM, Fabio Estevam wrote:
>> Hi Beno?t,
>>
>> On Thu, Sep 27, 2012 at 5:28 PM, Beno?t Th?baudeau
>> <benoit.thebaudeau@advansee.com> wrote:
>>> The FEC is the only SoC Ethernet support available on i.MX25, so
>>> define
>>> cpu_eth_init() only for it instead of returning a misleading
>>> success code.
>>
>> Yes, but someone may want to use mx25 with a external LAN device
>> (such
>> as LAN92xx) instead of FEC.
> 
> Yes, but in that case I think that there should be a board_eth_init() function
> defined, so this patch won't cause any trouble here. See in
> net/eth.c:eth_initialize() how these functions and their default implementations
> are handled.

I think also that in this case a board_eth_init() must be used - the
#ifdef in cpu_eth_init() is then superflous.

Best regards,
Stefano


-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
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
=====================================================================

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

* [U-Boot] [PATCH 5/7] mx25: Clean up clocks API
  2012-09-27 20:27 ` [U-Boot] [PATCH 5/7] mx25: Clean up clocks API Benoît Thébaudeau
@ 2012-09-28 10:31   ` Stefano Babic
  0 siblings, 0 replies; 13+ messages in thread
From: Stefano Babic @ 2012-09-28 10:31 UTC (permalink / raw)
  To: u-boot

On 27/09/2012 22:27, Beno?t Th?baudeau wrote:
> Use the standard mxc_get_clock() instead of exporting internal functions and
> using literal constant values.
> 
> Signed-off-by: Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>
> Cc: Stefano Babic <sbabic@denx.de>
> ---
>  .../arch/arm/cpu/arm926ejs/mx25/generic.c          |    6 +++---
>  .../arch/arm/include/asm/arch-mx25/clock.h         |    9 +++------
>  2 files changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git u-boot-imx-e1eb75b.orig/arch/arm/cpu/arm926ejs/mx25/generic.c u-boot-imx-e1eb75b/arch/arm/cpu/arm926ejs/mx25/generic.c
> index 5879b18..5da2582 100644
> --- u-boot-imx-e1eb75b.orig/arch/arm/cpu/arm926ejs/mx25/generic.c
> +++ u-boot-imx-e1eb75b/arch/arm/cpu/arm926ejs/mx25/generic.c
> @@ -72,7 +72,7 @@ static ulong imx_get_mpllclk(void)
>  	return imx_decode_pll(readl(&ccm->mpctl), fref);
>  }
>  
> -ulong imx_get_armclk(void)
> +static ulong imx_get_armclk(void)
>  {
>  	struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE;
>  	ulong cctl = readl(&ccm->cctl);
> @@ -88,7 +88,7 @@ ulong imx_get_armclk(void)
>  	return fref / div;
>  }
>  
> -ulong imx_get_ahbclk(void)
> +static ulong imx_get_ahbclk(void)
>  {
>  	struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE;
>  	ulong cctl = readl(&ccm->cctl);
> @@ -106,7 +106,7 @@ static ulong imx_get_ipgclk(void)
>  	return imx_get_ahbclk() / 2;
>  }
>  
> -ulong imx_get_perclk(int clk)
> +static ulong imx_get_perclk(int clk)
>  {
>  	struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE;
>  	ulong fref = imx_get_ahbclk();
> diff --git u-boot-imx-e1eb75b.orig/arch/arm/include/asm/arch-mx25/clock.h u-boot-imx-e1eb75b/arch/arm/include/asm/arch-mx25/clock.h
> index a532da5..efbe038 100644
> --- u-boot-imx-e1eb75b.orig/arch/arm/include/asm/arch-mx25/clock.h
> +++ u-boot-imx-e1eb75b/arch/arm/include/asm/arch-mx25/clock.h
> @@ -67,12 +67,9 @@ enum mxc_clock {
>  	MXC_CLK_NUM
>  };
>  
> -ulong imx_get_perclk(int clk);
> -ulong imx_get_ahbclk(void);
> -
> -#define imx_get_uartclk() imx_get_perclk(15)
> -#define imx_get_fecclk() mxc_get_clock(MXC_FEC_CLK)
> -
>  unsigned int mxc_get_clock(enum mxc_clock clk);
>  
> +#define imx_get_uartclk()	mxc_get_clock(MXC_UART_CLK)
> +#define imx_get_fecclk()	mxc_get_clock(MXC_FEC_CLK)
> +
>  #endif /* __ASM_ARCH_CLOCK_H */
> 

Tested on tx25.

Acked-by : Stefano Babic <sbabic@denx.de>
Tested-by: Stefano Babic <sbabic@denx.de>

Regards,
Stefano


-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
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
=====================================================================

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

* [U-Boot] [PATCH 4/7] mx25 clocks: Fix MXC_FEC_CLK
  2012-09-27 20:27 ` [U-Boot] [PATCH 4/7] mx25 clocks: Fix MXC_FEC_CLK Benoît Thébaudeau
@ 2012-09-28 10:33   ` Stefano Babic
  0 siblings, 0 replies; 13+ messages in thread
From: Stefano Babic @ 2012-09-28 10:33 UTC (permalink / raw)
  To: u-boot

On 27/09/2012 22:27, Beno?t Th?baudeau wrote:
> mxc_get_clock(MXC_FEC_CLK) should return the IPG clock, not the AHB clock.
> 
> Also, imx_get_fecclk() was correct but reimplemented the calculation of the IPG
> clock, so remove the duplicated code.
> 
> Signed-off-by: Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>
> Cc: Stefano Babic <sbabic@denx.de>
> ---
>  .../arch/arm/cpu/arm926ejs/mx25/generic.c          |    3 +--
>  .../arch/arm/include/asm/arch-mx25/clock.h         |    2 +-
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git u-boot-imx-e1eb75b.orig/arch/arm/cpu/arm926ejs/mx25/generic.c u-boot-imx-e1eb75b/arch/arm/cpu/arm926ejs/mx25/generic.c
> index 219c9eb..5879b18 100644
> --- u-boot-imx-e1eb75b.orig/arch/arm/cpu/arm926ejs/mx25/generic.c
> +++ u-boot-imx-e1eb75b/arch/arm/cpu/arm926ejs/mx25/generic.c
> @@ -129,9 +129,8 @@ unsigned int mxc_get_clock(enum mxc_clock clk)
>  		return imx_get_ahbclk();
>  	case MXC_IPG_CLK:
>  	case MXC_CSPI_CLK:
> -		return imx_get_ipgclk();
>  	case MXC_FEC_CLK:
> -		return imx_get_ahbclk();
> +		return imx_get_ipgclk();
>  	default:
>  		return imx_get_perclk(clk);
>  	}
> diff --git u-boot-imx-e1eb75b.orig/arch/arm/include/asm/arch-mx25/clock.h u-boot-imx-e1eb75b/arch/arm/include/asm/arch-mx25/clock.h
> index 9823f46..a532da5 100644
> --- u-boot-imx-e1eb75b.orig/arch/arm/include/asm/arch-mx25/clock.h
> +++ u-boot-imx-e1eb75b/arch/arm/include/asm/arch-mx25/clock.h
> @@ -71,7 +71,7 @@ ulong imx_get_perclk(int clk);
>  ulong imx_get_ahbclk(void);
>  
>  #define imx_get_uartclk() imx_get_perclk(15)
> -#define imx_get_fecclk() (imx_get_ahbclk()/2)
> +#define imx_get_fecclk() mxc_get_clock(MXC_FEC_CLK)
>  
>  unsigned int mxc_get_clock(enum mxc_clock clk);
>  
> 
Tested on tx25.

Acked-by : Stefano Babic <sbabic@denx.de>
Tested-by: Stefano Babic <sbabic@denx.de>

Regards,
Stefano

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
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
=====================================================================

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

* [U-Boot] [PATCH 1/7] mx25: Fix decode_pll
  2012-09-27 20:26 [U-Boot] [PATCH 1/7] mx25: Fix decode_pll Benoît Thébaudeau
                   ` (5 preceding siblings ...)
  2012-09-27 20:28 ` [U-Boot] [PATCH 7/7] mx25: Fix eSDHC support Benoît Thébaudeau
@ 2012-09-30 10:26 ` Stefano Babic
  6 siblings, 0 replies; 13+ messages in thread
From: Stefano Babic @ 2012-09-30 10:26 UTC (permalink / raw)
  To: u-boot

On 27/09/2012 22:26, Beno?t Th?baudeau wrote:
> The MFN bit-field of the PLL registers represents a signed value. See the
> reference manual.
> 
> Signed-off-by: Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>
> Cc: Stefano Babic <sbabic@denx.de>
> ---

All series applied to u-boot-imx, next branch, thanks.

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
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
=====================================================================

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

end of thread, other threads:[~2012-09-30 10:26 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-27 20:26 [U-Boot] [PATCH 1/7] mx25: Fix decode_pll Benoît Thébaudeau
2012-09-27 20:27 ` [U-Boot] [PATCH 2/7] mx25: Clean up clock calculations Benoît Thébaudeau
2012-09-27 20:27 ` [U-Boot] [PATCH 3/7] mx25: Define more standard clocks Benoît Thébaudeau
2012-09-27 20:27 ` [U-Boot] [PATCH 4/7] mx25 clocks: Fix MXC_FEC_CLK Benoît Thébaudeau
2012-09-28 10:33   ` Stefano Babic
2012-09-27 20:27 ` [U-Boot] [PATCH 5/7] mx25: Clean up clocks API Benoît Thébaudeau
2012-09-28 10:31   ` Stefano Babic
2012-09-27 20:28 ` [U-Boot] [PATCH 6/7] mx25: Define cpu_eth_init() only if needed Benoît Thébaudeau
2012-09-27 20:55   ` Fabio Estevam
2012-09-27 21:43     ` Benoît Thébaudeau
2012-09-28  9:09       ` Stefano Babic
2012-09-27 20:28 ` [U-Boot] [PATCH 7/7] mx25: Fix eSDHC support Benoît Thébaudeau
2012-09-30 10:26 ` [U-Boot] [PATCH 1/7] mx25: Fix decode_pll Stefano Babic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox