From 4cd8ed40615a7d741ef2f09ee53779ec6907b8a6 Mon Sep 17 00:00:00 2001 From: Ben Warren Date: Tue, 9 Dec 2008 23:26:31 -0800 Subject: Fix compile error in building MBX860T. Bug was introduced in 9eb79bd8856bcab896ed5e1f1bca159807a124dd Signed-off-by: Ben Warren --- cpu/mpc8xx/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cpu') diff --git a/cpu/mpc8xx/cpu.c b/cpu/mpc8xx/cpu.c index 40f81efc3c..2eb848bd0e 100644 --- a/cpu/mpc8xx/cpu.c +++ b/cpu/mpc8xx/cpu.c @@ -644,7 +644,7 @@ void reset_8xx_watchdog (volatile immap_t * immr) */ int cpu_eth_init(bd_t *bis) { -#if defined(SCC_ENET) +#if defined(SCC_ENET) && defined(CONFIG_CMD_NET) scc_initialize(bis); #endif #if defined(FEC_ENET) -- cgit v1.2.3 From bd3980cc095af1728b994cdd8bf1ac430b6289e6 Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu Date: Fri, 21 Nov 2008 12:04:18 +0900 Subject: sh: sh_eth: Change new network API sh_eth used old network API. This patch changed new API. Signed-off-by: Nobuhiro Iwamatsu Signed-off-by: Ben Warren --- cpu/sh4/cpu.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cpu') diff --git a/cpu/sh4/cpu.c b/cpu/sh4/cpu.c index d94e139815..52b6cfd684 100644 --- a/cpu/sh4/cpu.c +++ b/cpu/sh4/cpu.c @@ -82,3 +82,11 @@ int dcache_status (void) { return 0; } + +int cpu_eth_init(bd_t *bis) +{ +#ifdef CONFIG_SH_ETHER + sh_eth_initialize(bis); +#endif + return 0; +} -- cgit v1.2.3 From ba705b5b1a97b47388ed48858bef6bf7b6bfcd56 Mon Sep 17 00:00:00 2001 From: Gary Jennejohn Date: Thu, 20 Nov 2008 12:28:38 +0100 Subject: mgcoge make ether_scc.c work with CONFIG_NET_MULTI This change is needed for mgcoge because it uses two ethernet drivers. Add a check for the presence of the PIGGY board on mgcoge. Without this board networking cannot work and the initialization must be aborted. Only allocate rtx once to prevent DPRAM exhaustion. Initialize ether_scc.c and the keymile-specific HDLC driver (to be added soon) in eth.c. Signed-off-by: Gary Jennejohn Signed-off-by: Ben Warren --- cpu/mpc8260/Makefile | 8 ++++++-- cpu/mpc8260/cpu.c | 3 +++ cpu/mpc8260/ether_scc.c | 50 +++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 49 insertions(+), 12 deletions(-) (limited to 'cpu') diff --git a/cpu/mpc8260/Makefile b/cpu/mpc8260/Makefile index 80d785229c..9f0c2dd50c 100644 --- a/cpu/mpc8260/Makefile +++ b/cpu/mpc8260/Makefile @@ -1,5 +1,5 @@ # -# (C) Copyright 2000-2006 +# (C) Copyright 2000-2008 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. # # See file CREDITS for list of people who contributed to this @@ -27,9 +27,13 @@ LIB = $(obj)lib$(CPU).a START = start.o kgdb.o COBJS = traps.o serial_smc.o serial_scc.o cpu.o cpu_init.o speed.o \ - interrupts.o ether_scc.o ether_fcc.o i2c.o commproc.o \ + interrupts.o ether_fcc.o i2c.o commproc.o \ bedbug_603e.o pci.o spi.o +COBJS-$(CONFIG_ETHER_ON_SCC) = ether_scc.o + +COBJS += $(COBJS-y) + SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) START := $(addprefix $(obj),$(START)) diff --git a/cpu/mpc8260/cpu.c b/cpu/mpc8260/cpu.c index b9e748ab8b..f4beca55be 100644 --- a/cpu/mpc8260/cpu.c +++ b/cpu/mpc8260/cpu.c @@ -325,6 +325,9 @@ int cpu_eth_init(bd_t *bis) { #if defined(CONFIG_ETHER_ON_FCC) fec_initialize(bis); +#endif +#if defined(CONFIG_ETHER_ON_SCC) + mpc82xx_scc_enet_initialize(bd); #endif return 0; } diff --git a/cpu/mpc8260/ether_scc.c b/cpu/mpc8260/ether_scc.c index c65f0e068f..3671ef1dfb 100644 --- a/cpu/mpc8260/ether_scc.c +++ b/cpu/mpc8260/ether_scc.c @@ -10,6 +10,12 @@ * Advent Networks, Inc. * Jay Monkman * + * Modified so that it plays nicely when more than one ETHERNET interface + * is in use a la ether_fcc.c. + * (C) Copyright 2008 + * DENX Software Engineerin GmbH + * Gary Jennejohn + * * See file CREDITS for list of people who contributed to this * project. * @@ -32,11 +38,14 @@ #include #include #include +#include #include #include #include -#if defined(CONFIG_ETHER_ON_SCC) && defined(CONFIG_CMD_NET) +#ifndef CONFIG_NET_MULTI +#error "CONFIG_NET_MULTI must be defined." +#endif #if (CONFIG_ETHER_INDEX == 1) # define PROFF_ENET PROFF_SCC1 @@ -100,7 +109,7 @@ typedef volatile struct CommonBufferDescriptor { static RTXBD *rtx; -int eth_send(volatile void *packet, int length) +static int sec_send(struct eth_device *dev, volatile void *packet, int length) { int i; int result = 0; @@ -137,7 +146,7 @@ int eth_send(volatile void *packet, int length) } -int eth_rx(void) +static int sec_rx(struct eth_device *dev) { int length; @@ -184,7 +193,7 @@ int eth_rx(void) * *************************************************************/ -int eth_init(bd_t *bis) +static int sec_init(struct eth_device *dev, bd_t *bis) { int i; volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR; @@ -194,9 +203,14 @@ int eth_init(bd_t *bis) rxIdx = 0; txIdx = 0; - /* assign static pointer to BD area */ - dpaddr = m8260_cpm_dpalloc(sizeof(RTXBD) + 2, 16); - rtx = (RTXBD *)&immr->im_dprambase[dpaddr]; + /* + * Assign static pointer to BD area. + * Avoid exhausting DPRAM, which would cause a panic. + */ + if (rtx == NULL) { + dpaddr = m8260_cpm_dpalloc(sizeof(RTXBD) + 2, 16); + rtx = (RTXBD *)&immr->im_dprambase[dpaddr]; + } /* 24.21 - (1-3): ioports have been set up already */ @@ -338,7 +352,7 @@ int eth_init(bd_t *bis) } -void eth_halt(void) +static void sec_halt(struct eth_device *dev) { volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR; immr->im_scc[CONFIG_ETHER_INDEX-1].scc_gsmrl &= ~(SCC_GSMRL_ENR | @@ -346,7 +360,7 @@ void eth_halt(void) } #if 0 -void restart(void) +static void sec_restart(void) { volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR; immr->im_cpm.cp_scc[CONFIG_ETHER_INDEX-1].scc_gsmrl |= (SCC_GSMRL_ENR | @@ -354,4 +368,20 @@ void restart(void) } #endif -#endif +int mpc82xx_scc_enet_initialize(bd_t *bis) +{ + struct eth_device *dev; + + dev = (struct eth_device *) malloc(sizeof *dev); + memset(dev, 0, sizeof *dev); + + sprintf(dev->name, "SCC ETHERNET"); + dev->init = sec_init; + dev->halt = sec_halt; + dev->send = sec_send; + dev->recv = sec_rx; + + eth_register(dev); + + return 1; +} -- cgit v1.2.3