From 63ebcc4615dd39926ccf61f1d5f3510262ef6564 Mon Sep 17 00:00:00 2001 From: Michael Schwingen Date: Sat, 10 Nov 2007 15:44:12 +0100 Subject: load ixp42x NPE firmware from separate flash block, remove dead code Hi, the following patch adds support to move the IXP42X NPE firmware to a separate flash block, whose start address is defined in CONFIG_IXP4XX_NPE_EXT_UCODE_BASE. Using that, it is possible to build NPE-enabled u-boot without copyright problems due to the NPE firmware. I hope the patch applies, I get whitespace-related differences in the NPE files due to trailing whitespace in the original versions. Signed-off-by: Michael Schwingen Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- cpu/ixp/npe/IxNpeDl.c | 32 -------------------------------- cpu/ixp/npe/IxNpeDlImageMgr.c | 12 ++++++++---- cpu/ixp/npe/Makefile | 4 +++- 3 files changed, 11 insertions(+), 37 deletions(-) (limited to 'cpu') diff --git a/cpu/ixp/npe/IxNpeDl.c b/cpu/ixp/npe/IxNpeDl.c index ffe355c511..3738337538 100644 --- a/cpu/ixp/npe/IxNpeDl.c +++ b/cpu/ixp/npe/IxNpeDl.c @@ -108,38 +108,6 @@ static BOOL ixNpeDlNpeStarted[IX_NPEDL_NPEID_MAX] ={FALSE, FALSE, FALSE} ; PRIVATE IX_STATUS ixNpeDlNpeInitAndStartInternal (UINT32 *imageLibrary, UINT32 imageId); -/* - * Function definition: ixNpeDlMicrocodeImageLibraryOverride - */ -PUBLIC IX_STATUS -ixNpeDlMicrocodeImageLibraryOverride (UINT32 *clientImageLibrary) -{ - IX_STATUS status = IX_SUCCESS; - - IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT, - "Entering ixNpeDlMicrocodeImageLibraryOverride\n"); - - if (clientImageLibrary == NULL) - { - status = IX_NPEDL_PARAM_ERR; - IX_NPEDL_ERROR_REPORT ("ixNpeDlMicrocodeImageLibraryOverride - " - "invalid parameter\n"); - } - else - { - status = ixNpeDlImageMgrMicrocodeImageLibraryOverride (clientImageLibrary); - if (status != IX_SUCCESS) - { - status = IX_FAIL; - } - } /* end of if-else(clientImageLibrary) */ - - IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT, - "Exiting ixNpeDlMicrocodeImageLibraryOverride : " - "status = %d\n", status); - return status; -} - /* * Function definition: ixNpeDlImageDownload */ diff --git a/cpu/ixp/npe/IxNpeDlImageMgr.c b/cpu/ixp/npe/IxNpeDlImageMgr.c index e05c228537..c0e7349da4 100644 --- a/cpu/ixp/npe/IxNpeDlImageMgr.c +++ b/cpu/ixp/npe/IxNpeDlImageMgr.c @@ -134,8 +134,8 @@ typedef struct static IxNpeDlImageMgrStats ixNpeDlImageMgrStats; /* default image */ -#ifdef IX_NPEDL_READ_MICROCODE_FROM_FILE -static UINT32 *IxNpeMicroCodeImageLibrary = NULL; /* Gets set to proper value at runtime */ +#ifdef CONFIG_IXP4XX_NPE_EXT_UCODE_BASE +static UINT32 *IxNpeMicroCodeImageLibrary = (UINT32 *)CONFIG_IXP4XX_NPE_EXT_UCODE_BASE; #else static UINT32 *IxNpeMicroCodeImageLibrary = (UINT32 *)IxNpeMicrocode_array; #endif @@ -158,6 +158,7 @@ PRIVATE BOOL ixNpeDlImageMgrNpeFunctionIdCompare (IxNpeDlImageId *imageIdA, IxNpeDlImageId *imageIdB); +#if 0 PRIVATE IX_STATUS ixNpeDlImageMgrImageFind_legacy (UINT32 *imageLibrary, UINT32 imageId, @@ -195,7 +196,7 @@ ixNpeDlImageMgrMicrocodeImageLibraryOverride ( status); return status; } - +#endif /* * Function definition: ixNpeDlImageMgrImageListExtract @@ -527,6 +528,7 @@ ixNpeDlImageMgrStatsReset (void) } +#if 0 /* * Function definition: ixNpeDlImageMgrImageFind_legacy * @@ -600,7 +602,7 @@ ixNpeDlImageMgrImageFind_legacy ( "Exiting ixNpeDlImageMgrImageFind: status = %d\n", status); return status; } - +#endif /* * Function definition: ixNpeDlImageMgrImageFind @@ -635,6 +637,7 @@ ixNpeDlImageMgrImageFind ( #endif /* IX_NPEDL_READ_MICROCODE_FROM_FILE */ } +#if 0 /* For backward's compatibility with previous image format */ if (ixNpeDlImageMgrSignatureCheck(imageLibrary)) { @@ -643,6 +646,7 @@ ixNpeDlImageMgrImageFind ( imagePtr, imageSize); } +#endif while (*(imageLibrary+offset) == NPE_IMAGE_MARKER) { diff --git a/cpu/ixp/npe/Makefile b/cpu/ixp/npe/Makefile index 7f020b5d57..25117d787f 100644 --- a/cpu/ixp/npe/Makefile +++ b/cpu/ixp/npe/Makefile @@ -72,7 +72,6 @@ COBJS := npe.o \ IxNpeDlImageMgr.o \ IxNpeDlNpeMgr.o \ IxNpeDlNpeMgrUtils.o \ - IxNpeMicrocode.o \ IxNpeMh.o \ IxNpeMhConfig.o \ IxNpeMhReceive.o \ @@ -80,6 +79,9 @@ COBJS := npe.o \ IxNpeMhSolicitedCbMgr.o \ IxNpeMhUnsolicitedCbMgr.o +ifndef CONFIG_IXP4XX_NPE_EXT_UCODE_BASE +COBJS += IxNpeMicrocode.o +endif SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) -- cgit v1.2.1 From a1cf027a08f9dc1c0e769499e6f4fbddcf9cab93 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Mon, 7 Jan 2008 08:41:34 +0100 Subject: IXP: add dynamic microcode addr allow to load the microde from flash or ram by download it through the serial or other. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Acked-by: Stefan Roese --- cpu/ixp/npe/IxNpeDlImageMgr.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'cpu') diff --git a/cpu/ixp/npe/IxNpeDlImageMgr.c b/cpu/ixp/npe/IxNpeDlImageMgr.c index c0e7349da4..75b42f2f8f 100644 --- a/cpu/ixp/npe/IxNpeDlImageMgr.c +++ b/cpu/ixp/npe/IxNpeDlImageMgr.c @@ -140,6 +140,14 @@ static UINT32 *IxNpeMicroCodeImageLibrary = (UINT32 *)CONFIG_IXP4XX_NPE_EXT_UCOD static UINT32 *IxNpeMicroCodeImageLibrary = (UINT32 *)IxNpeMicrocode_array; #endif +static UINT32* getIxNpeMicroCodeImageLibrary(void) +{ + char *s; + if ((s = getenv("npe_ucode")) != NULL) + return (UINT32*) simple_strtoul(s, NULL, 16); + else + return IxNpeMicroCodeImageLibrary; +} /* * static function prototypes. @@ -218,9 +226,9 @@ ixNpeDlImageMgrImageListExtract ( IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT, "Entering ixNpeDlImageMgrImageListExtract\n"); - header = (IxNpeDlImageMgrImageLibraryHeader *) IxNpeMicroCodeImageLibrary; + header = (IxNpeDlImageMgrImageLibraryHeader *) getIxNpeMicroCodeImageLibrary(); - if (ixNpeDlImageMgrSignatureCheck (IxNpeMicroCodeImageLibrary)) + if (ixNpeDlImageMgrSignatureCheck (getIxNpeMicroCodeImageLibrary())) { /* for each image entry in the image header ... */ while (header->entry[imageCount].eohMarker != @@ -291,9 +299,9 @@ ixNpeDlImageMgrImageLocate ( IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT, "Entering ixNpeDlImageMgrImageLocate\n"); - header = (IxNpeDlImageMgrImageLibraryHeader *) IxNpeMicroCodeImageLibrary; + header = (IxNpeDlImageMgrImageLibraryHeader *) getIxNpeMicroCodeImageLibrary(); - if (ixNpeDlImageMgrSignatureCheck (IxNpeMicroCodeImageLibrary)) + if (ixNpeDlImageMgrSignatureCheck (getIxNpeMicroCodeImageLibrary())) { /* for each image entry in the image library header ... */ while (header->entry[imageCount].eohMarker != @@ -308,8 +316,9 @@ ixNpeDlImageMgrImageLocate ( * get pointer to the image in the image library using offset from * 1st word in image library */ + UINT32 *tmp=getIxNpeMicroCodeImageLibrary(); imageOffset = header->entry[imageCount].image.offset; - *imagePtr = &IxNpeMicroCodeImageLibrary[imageOffset]; + *imagePtr = &tmp[imageOffset]; /* get the image size */ *imageSize = header->entry[imageCount].image.size; status = IX_SUCCESS; @@ -354,9 +363,9 @@ ixNpeDlImageMgrLatestImageExtract (IxNpeDlImageId *imageId) IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT, "Entering ixNpeDlImageMgrLatestImageExtract\n"); - header = (IxNpeDlImageMgrImageLibraryHeader *) IxNpeMicroCodeImageLibrary; + header = (IxNpeDlImageMgrImageLibraryHeader *) getIxNpeMicroCodeImageLibrary(); - if (ixNpeDlImageMgrSignatureCheck (IxNpeMicroCodeImageLibrary)) + if (ixNpeDlImageMgrSignatureCheck (getIxNpeMicroCodeImageLibrary())) { /* for each image entry in the image library header ... */ while (header->entry[imageCount].eohMarker != @@ -633,7 +642,7 @@ ixNpeDlImageMgrImageFind ( imageLibrary = ixNpeMicrocode_binaryArray; } #else - imageLibrary = IxNpeMicroCodeImageLibrary; + imageLibrary = getIxNpeMicroCodeImageLibrary(); #endif /* IX_NPEDL_READ_MICROCODE_FROM_FILE */ } -- cgit v1.2.1 From 96bd462942022e4569b582c072a0ed26de1cd19b Mon Sep 17 00:00:00 2001 From: Michael Schwingen Date: Thu, 10 Jan 2008 14:59:46 +0100 Subject: IXP: enable RTS enables the RTS signal with CONFIG_SERIAL_RTS_ACTIVE. No handshaking is done, but the active RTS signal allows to connect to the target using a PC which is using RTS/CTS handshake, and does no harm if the PC is set to ignore RTS. Signed-off-by: Michael Schwingen --- cpu/ixp/serial.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cpu') diff --git a/cpu/ixp/serial.c b/cpu/ixp/serial.c index cf520b699e..45496318a8 100644 --- a/cpu/ixp/serial.c +++ b/cpu/ixp/serial.c @@ -58,7 +58,11 @@ void serial_setbrg (void) DLL(uart) = quot & 0xff; DLH(uart) = quot >> 8; LCR(uart) = LCR_WLS0 | LCR_WLS1; - +#ifdef CONFIG_SERIAL_RTS_ACTIVE + MCR(uart) = MCR_RTS; /* set RTS active */ +#else + MCR(uart) = 0; /* set RTS inactive */ +#endif IER(uart) = IER_UUE; } -- cgit v1.2.1