From 1f4bb37d6bcae59b18a2438f3cdca6545a831ab5 Mon Sep 17 00:00:00 2001 From: wdenk Date: Sun, 27 Jul 2003 00:21:01 +0000 Subject: * Patch by Scott McNutt, 21 Jul 2003: Add support for LynuxWorks Kernel Downloadable Images (KDIs). Both LynxOS and BlueCat linux KDIs are supported. * Patch by Richard Woodruff, 25 Jul 2003: use more reliable reset for OMAP/925T * Patch by Nye Liu, 25 Jul 2003: fix typo in mpc8xx.h * Patch by Richard Woodruff, 24 Jul 2003: Fixes for cmd_nand.c: - Fixed null dereferece which could result in incorrect ECC values. - Added support for devices with no Ready/Busy signal hooked up. - Added OMAP1510 read/write protect handling. - Fixed nand.h's ECCPOS. A conflict existed with POS5 and badblock for non-JFFS2. - Switched default ECC to be JFFS2. --- common/lynxkdi.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 common/lynxkdi.c (limited to 'common/lynxkdi.c') diff --git a/common/lynxkdi.c b/common/lynxkdi.c new file mode 100644 index 000000000..95df9554f --- /dev/null +++ b/common/lynxkdi.c @@ -0,0 +1,70 @@ +/* + * Copyright (c) Orbacom Systems, Inc + * All rights reserved. + * + * Redistribution and use in source and binary forms are freely + * permitted provided that the above copyright notice and this + * paragraph and the following disclaimer are duplicated in all + * such forms. + * + * This software is provided "AS IS" and without any express or + * implied warranties, including, without limitation, the implied + * warranties of merchantability and fitness for a particular + * purpose. + */ + +#include +#include +#include + +#if defined(CONFIG_LYNXKDI) +#include + +#if defined(CONFIG_MPC8260) +void lynxkdi_boot ( image_header_t *hdr ) +{ + void (*lynxkdi)(void) = (void(*)(void))hdr->ih_ep; + lynxos_bootparms_t *parms = (lynxos_bootparms_t *)0x0020; + bd_t *kbd; + DECLARE_GLOBAL_DATA_PTR; + u32 *psz = (u32 *)(hdr->ih_load + 0x0204); + + memset( parms, 0, sizeof(*parms)); + kbd = gd->bd; + parms->clock_ref = kbd->bi_busfreq; + parms->dramsz = kbd->bi_memsize; + memcpy(parms->ethaddr, kbd->bi_enetaddr, 6); + mtspr(SPRN_SPRG2, 0x0020); + + /* Do a simple check for Bluecat so we can pass the + * kernel command line parameters. + */ + if( le32_to_cpu(*psz) == hdr->ih_size ){ + char *args; + char *cmdline = (char *)(hdr->ih_load + 0x020c); + int len; + + printf("Booting Bluecat KDI ...\n"); + udelay(200*1000); /* Allow serial port to flush */ + if ((args = getenv("bootargs")) == NULL) + args = ""; + /* Prepend the cmdline */ + len = strlen(args); + if( len && (len + strlen(cmdline) + 2 < (0x0400 - 0x020c))) { + memmove( cmdline + strlen(args) + 1, cmdline, strlen(cmdline) ); + strcpy( cmdline, args ); + cmdline[len] = ' '; + } + } + else { + printf("Booting LynxOS KDI ...\n"); + } + + lynxkdi(); +} +#else +#error "Lynx KDI support not implemented for configured CPU" +#endif + +#endif /* CONFIG_LYNXKDI */ + -- cgit v1.2.3