diff mbox

[U-Boot,6/7] mx25: Define cpu_eth_init() only if needed

Message ID 1472452180.5372631.1348777689505.JavaMail.root@advansee.com
State Awaiting Upstream
Delegated to: Stefano Babic
Headers show

Commit Message

Benoît Thébaudeau Sept. 27, 2012, 8:28 p.m. UTC
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(-)

Comments

Fabio Estevam Sept. 27, 2012, 8:55 p.m. UTC | #1
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
Benoît Thébaudeau Sept. 27, 2012, 9:43 p.m. UTC | #2
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
Stefano Babic Sept. 28, 2012, 9:09 a.m. UTC | #3
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
diff mbox

Patch

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)
 {