summaryrefslogtreecommitdiffstats
path: root/arch/ppc/mbxboot
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-06-19 22:45:37 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-06-19 22:45:37 +0000
commit6d403070f28cd44860fdb3a53be5da0275c65cf4 (patch)
tree0d0e7fe7b5fb7568d19e11d7d862b77a866ce081 /arch/ppc/mbxboot
parentecf1bf5f6c2e668d03b0a9fb026db7aa41e292e1 (diff)
Merge with 2.4.0-test1-ac21 + pile of MIPS cleanups to make merging
possible. Chainsawed RM200 kernel to compile again. Jazz machine status unknown.
Diffstat (limited to 'arch/ppc/mbxboot')
-rw-r--r--arch/ppc/mbxboot/Makefile75
-rw-r--r--arch/ppc/mbxboot/embed_config.c16
-rw-r--r--arch/ppc/mbxboot/head_8260.S5
-rw-r--r--arch/ppc/mbxboot/m8260_tty.c4
-rw-r--r--arch/ppc/mbxboot/mbxtty.c201
5 files changed, 45 insertions, 256 deletions
diff --git a/arch/ppc/mbxboot/Makefile b/arch/ppc/mbxboot/Makefile
index 53611aa58..9dd5d64f3 100644
--- a/arch/ppc/mbxboot/Makefile
+++ b/arch/ppc/mbxboot/Makefile
@@ -28,14 +28,14 @@ ISZ = 0
TFTPIMAGE=/tftpboot/zImage.embedded
ifdef CONFIG_8xx
-ZLINKFLAGS = -T vmlinux.lds -Ttext 0x00180000
-OBJECTS := head.o misc.o ../coffboot/zlib.o m8xx_tty.o gzimage.o rdimage.o
+ZLINKFLAGS = -T ../vmlinux.lds -Ttext 0x00180000
+OBJECTS := head.o misc.o ../coffboot/zlib.o m8xx_tty.o
CFLAGS = $(CPPFLAGS) -O2 -DSTDC_HEADERS -fno-builtin -DCONFIG_8xx
endif
ifdef CONFIG_8260
-ZLINKFLAGS = -T vmlinux.lds -Ttext 0x00400000
-OBJECTS := head_8260.o misc.o ../coffboot/zlib.o m8260_tty.o embed_config.o gzimage.o rdimage.o
+ZLINKFLAGS = -T ../vmlinux.lds -Ttext 0x00400000
+OBJECTS := head_8260.o misc.o ../coffboot/zlib.o m8260_tty.o embed_config.o
CFLAGS = $(CPPFLAGS) -O2 -DSTDC_HEADERS -fno-builtin -DCONFIG_8260
endif
@@ -61,32 +61,21 @@ endif
all: zImage
zvmlinux.initrd: zvmlinux
-#
-# Build the boot loader images
-#
- $(OBJCOPY) $(OBJCOPY_ARGS) -R .gzimage gzimage.o
+ $(LD) $(ZLINKFLAGS) -o zvmlinux.initrd.tmp1 $(OBJECTS)
$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
- --add-section=.gzimage=../coffboot/vmlinux.gz \
- --set-section-flags=.gzimage=alloc,load,readonly,data \
- gzimage.o
- $(OBJCOPY) $(OBJCOPY_ARGS) -R .rdimage rdimage.o
- $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
- --add-section=.rdimage=ramdisk.image.gz \
- --set-section-flags=.rdimage=alloc,load,readonly,data \
- rdimage.o
- $(LD) $(ZLINKFLAGS) -o $@ $(OBJECTS)
-#
-# Compute the sizes/offsets for the final image, and rebuild with these values.
-#
- $(CC) $(CFLAGS) \
- -DINITRD_OFFSET=`sh offset $(OBJDUMP) zvmlinux.initrd .rdimage` \
- -DINITRD_SIZE=`sh size $(OBJDUMP) zvmlinux.initrd .rdimage` \
- -DZIMAGE_OFFSET=`sh offset $(OBJDUMP) zvmlinux.initrd .gzimage` \
- -DZIMAGE_SIZE=`sh size $(OBJDUMP) zvmlinux.initrd .gzimage` \
+ --add-section=initrd=ramdisk.image.gz \
+ --add-section=image=../coffboot/vmlinux.gz \
+ zvmlinux.initrd.tmp1 zvmlinux.initrd1
+ $(CC) $(CFLAGS) -DINITRD_OFFSET=`sh offset $(OBJDUMP) zvmlinux.initrd1 initrd` \
+ -DINITRD_SIZE=`sh size $(OBJDUMP) zvmlinux.initrd1 initrd` \
+ -DZIMAGE_OFFSET=`sh offset $(OBJDUMP) zvmlinux.initrd1 image` \
+ -DZIMAGE_SIZE=`sh size $(OBJDUMP) zvmlinux.initrd1 image` \
-c -o misc.o misc.c
- $(LD) $(ZLINKFLAGS) -o $@ $(OBJECTS)
- $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment $@
- $(OBJDUMP) -h $@
+ $(LD) $(ZLINKFLAGS) -o zvmlinux.initrd.tmp $(OBJECTS)
+ $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
+ --add-section=initrd=ramdisk.image.gz \
+ --add-section=image=../coffboot/vmlinux.gz \
+ zvmlinux.initrd.tmp $@
zImage: zvmlinux
ln -sf zvmlinux zImage
@@ -96,27 +85,23 @@ zImage.initrd: zvmlinux.initrd
zvmlinux: $(OBJECTS) ../coffboot/vmlinux.gz
#
-# Build the boot loader images
+# build the boot loader image and then compute the offset into it
+# for the kernel image
#
+ $(LD) $(ZLINKFLAGS) -o zvmlinux.tmp $(OBJECTS)
+ $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment --add-section=image=../coffboot/vmlinux.gz \
+ zvmlinux.tmp $@
#
- $(OBJCOPY) $(OBJCOPY_ARGS) -R .gzimage gzimage.o
- $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
- --add-section=.gzimage=../coffboot/vmlinux.gz \
- --set-section-flags=.gzimage=alloc,load,readonly,data \
- gzimage.o
- $(LD) $(ZLINKFLAGS) -o $@ $(OBJECTS)
-#
-# Compute the sizes/offsets for the final image, and rebuild with these values.
+# then with the offset rebuild the bootloader so we know where the kernel is
#
- $(CC) $(CFLAGS) \
- -DINITRD_OFFSET=0 \
- -DINITRD_SIZE=0 \
- -DZIMAGE_OFFSET=`sh offset $(OBJDUMP) zvmlinux .gzimage` \
- -DZIMAGE_SIZE=`sh size $(OBJDUMP) zvmlinux .gzimage` \
+ $(CC) $(CFLAGS) -DINITRD_OFFSET=0 -DINITRD_SIZE=0 \
+ -DZIMAGE_OFFSET=`sh offset $(OBJDUMP) zvmlinux image` \
+ -DZIMAGE_SIZE=`sh size $(OBJDUMP) zvmlinux image` \
-c -o misc.o misc.c
- $(LD) $(ZLINKFLAGS) -o $@ $(OBJECTS)
- $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment $@
- $(OBJDUMP) -h $@
+ $(LD) $(ZLINKFLAGS) -o zvmlinux.tmp $(OBJECTS)
+ $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment --add-section=image=../coffboot/vmlinux.gz \
+ zvmlinux.tmp $@
+ rm zvmlinux.tmp
znetboot : zImage
cp zImage $(TFTPIMAGE)
diff --git a/arch/ppc/mbxboot/embed_config.c b/arch/ppc/mbxboot/embed_config.c
index 048f8bcfe..11c37f796 100644
--- a/arch/ppc/mbxboot/embed_config.c
+++ b/arch/ppc/mbxboot/embed_config.c
@@ -3,7 +3,7 @@
* not have boot monitor support for board information.
*/
#include <sys/types.h>
-#include <linux/config.h>
+#include <linux/autoconf.h>
#ifdef CONFIG_8xx
#include <asm/mpc8xx.h>
#endif
@@ -231,17 +231,17 @@ embed_config(bd_t *bd)
u_char *cp;
int i;
-#if 1
+#if 0
/* This is actually provided by my boot rom. I have it
* here for those people that may load the kernel with
* a JTAG/COP tool and not the rom monitor.
*/
- bd->bi_baudrate = 19200;
- bd->bi_intfreq = 165;
- bd->bi_busfreq = 33;
- bd->bi_cpmfreq = 132;
- bd->bi_brgfreq = bd->bi_cpmfreq / 2; /* BRGCLK = (CPM*2/4) */
- bd->bi_memsize = 16 * 1024 * 1024;
+ bd->bi_baudrate = 115200;
+ bd->bi_intfreq = 200;
+ bd->bi_busfreq = 66;
+ bd->bi_cpmfreq = 66;
+ bd->bi_brgfreq = 33;
+ bd->bi_memsize = 16 * 1024 * 1024;
#endif
cp = (u_char *)def_enet_addr;
diff --git a/arch/ppc/mbxboot/head_8260.S b/arch/ppc/mbxboot/head_8260.S
index 0895ce025..3e4bf700a 100644
--- a/arch/ppc/mbxboot/head_8260.S
+++ b/arch/ppc/mbxboot/head_8260.S
@@ -101,6 +101,11 @@ start_ldr:
subi r1,r1,256
li r2,0x000F /* Mask pointer to 16-byte boundary */
andc r1,r1,r2
+
+ /* Speed us up a little.
+ */
+ bl flush_instruction_cache
+
/* Run loader */
mr r3,r8 /* Load point */
mr r4,r7 /* Program length */
diff --git a/arch/ppc/mbxboot/m8260_tty.c b/arch/ppc/mbxboot/m8260_tty.c
index 1340577ab..167abbdcc 100644
--- a/arch/ppc/mbxboot/m8260_tty.c
+++ b/arch/ppc/mbxboot/m8260_tty.c
@@ -72,8 +72,8 @@ serial_init(bd_t *bd)
*/
up->smc_rbase = dpaddr;
up->smc_tbase = dpaddr+sizeof(cbd_t);
- up->smc_rfcr = SMC_EB;
- up->smc_tfcr = SMC_EB;
+ up->smc_rfcr = CPMFCR_EB;
+ up->smc_tfcr = CPMFCR_EB;
up->smc_brklen = 0;
up->smc_brkec = 0;
up->smc_brkcr = 0;
diff --git a/arch/ppc/mbxboot/mbxtty.c b/arch/ppc/mbxboot/mbxtty.c
deleted file mode 100644
index e5566dc32..000000000
--- a/arch/ppc/mbxboot/mbxtty.c
+++ /dev/null
@@ -1,201 +0,0 @@
-
-
-/* Minimal serial functions needed to send messages out the serial
- * port on the MBX console.
- *
- * The MBX uxes SMC1 for the serial port. We reset the port and use
- * only the first BD that EPPC-Bug set up as a character FIFO.
- *
- * Later versions (at least 1.4, maybe earlier) of the MBX EPPC-Bug
- * use COM1 instead of SMC1 as the console port. This kinda sucks
- * for the rest of the kernel, so here we force the use of SMC1 again.
- * I f**ked around for a day trying to figure out how to make EPPC-Bug
- * use SMC1, but gave up and decided to fix it here.
- */
-#include <linux/config.h>
-#include <linux/types.h>
-#ifdef CONFIG_MBX
-#include <asm/mbx.h>
-#endif
-#ifdef CONFIG_FADS
-#include <asm/fads.h>
-#endif
-#include "../8xx_io/commproc.h"
-
-#ifdef CONFIG_MBX
-#define MBX_CSR1 ((volatile u_char *)0xfa100000)
-#define CSR1_COMEN (u_char)0x02
-#endif
-
-static cpm8xx_t *cpmp = (cpm8xx_t *)&(((immap_t *)IMAP_ADDR)->im_cpm);
-
-void
-serial_init(bd_t *bd)
-{
- volatile smc_t *sp;
- volatile smc_uart_t *up;
- volatile cbd_t *tbdf, *rbdf;
- volatile cpm8xx_t *cp;
- uint dpaddr, memaddr;
-
- cp = cpmp;
- sp = (smc_t*)&(cp->cp_smc[0]);
- up = (smc_uart_t *)&cp->cp_dparam[PROFF_SMC1];
-
- /* Disable transmitter/receiver.
- */
- sp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
-
-#ifdef CONFIG_MBX
- if (*MBX_CSR1 & CSR1_COMEN) {
- /* COM1 is enabled. Initialize SMC1 and use it for
- * the console port.
- */
-
- /* Enable SDMA.
- */
- ((immap_t *)IMAP_ADDR)->im_siu_conf.sc_sdcr = 1;
-
- /* Use Port B for SMCs instead of other functions.
- */
- cp->cp_pbpar |= 0x00000cc0;
- cp->cp_pbdir &= ~0x00000cc0;
- cp->cp_pbodr &= ~0x00000cc0;
-
- /* Allocate space for two buffer descriptors in the DP ram.
- * For now, this address seems OK, but it may have to
- * change with newer versions of the firmware.
- */
- dpaddr = 0x0800;
-
- /* Grab a few bytes from the top of memory. EPPC-Bug isn't
- * running any more, so we can do this.
- */
- memaddr = (bd->bi_memsize - 32) & ~15;
-
- /* Set the physical address of the host memory buffers in
- * the buffer descriptors.
- */
- rbdf = (cbd_t *)&cp->cp_dpmem[dpaddr];
- rbdf->cbd_bufaddr = memaddr;
- rbdf->cbd_sc = 0;
- tbdf = rbdf + 1;
- tbdf->cbd_bufaddr = memaddr+4;
- tbdf->cbd_sc = 0;
-
- /* Set up the uart parameters in the parameter ram.
- */
- up->smc_rbase = dpaddr;
- up->smc_tbase = dpaddr+sizeof(cbd_t);
- up->smc_rfcr = SMC_EB;
- up->smc_tfcr = SMC_EB;
-
- /* Set UART mode, 8 bit, no parity, one stop.
- * Enable receive and transmit.
- */
- sp->smc_smcmr = smcr_mk_clen(9) | SMCMR_SM_UART;
-
- /* Mask all interrupts and remove anything pending.
- */
- sp->smc_smcm = 0;
- sp->smc_smce = 0xff;
-
- /* Set up the baud rate generator.
- * See 8xx_io/commproc.c for details.
- */
- cp->cp_simode = 0x10000000;
- cp->cp_brgc1 =
- ((((bd->bi_intfreq * 1000000)/16) / 9600) << 1) | CPM_BRG_EN;
-
- /* Enable SMC1 for console output.
- */
- *MBX_CSR1 &= ~CSR1_COMEN;
- }
- else {
-#endif
- /* SMC1 is used as console port.
- */
- tbdf = (cbd_t *)&cp->cp_dpmem[up->smc_tbase];
- rbdf = (cbd_t *)&cp->cp_dpmem[up->smc_rbase];
-
- /* Issue a stop transmit, and wait for it.
- */
- cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_SMC1,
- CPM_CR_STOP_TX) | CPM_CR_FLG;
- while (cp->cp_cpcr & CPM_CR_FLG);
-#ifdef CONFIG_MBX
- }
-#endif
-
- /* Make the first buffer the only buffer.
- */
- tbdf->cbd_sc |= BD_SC_WRAP;
- rbdf->cbd_sc |= BD_SC_EMPTY | BD_SC_WRAP;
-
- /* Single character receive.
- */
- up->smc_mrblr = 1;
- up->smc_maxidl = 0;
-
- /* Initialize Tx/Rx parameters.
- */
- cp->cp_cpcr = mk_cr_cmd(CPM_CR_CH_SMC1, CPM_CR_INIT_TRX) | CPM_CR_FLG;
- while (cp->cp_cpcr & CPM_CR_FLG);
-
- /* Enable transmitter/receiver.
- */
- sp->smc_smcmr |= SMCMR_REN | SMCMR_TEN;
-}
-
-void
-serial_putchar(const char c)
-{
- volatile cbd_t *tbdf;
- volatile char *buf;
- volatile smc_uart_t *up;
-
- up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_SMC1];
- tbdf = (cbd_t *)&cpmp->cp_dpmem[up->smc_tbase];
-
- /* Wait for last character to go.
- */
- buf = (char *)tbdf->cbd_bufaddr;
- while (tbdf->cbd_sc & BD_SC_READY);
-
- *buf = c;
- tbdf->cbd_datlen = 1;
- tbdf->cbd_sc |= BD_SC_READY;
-}
-
-char
-serial_getc()
-{
- volatile cbd_t *rbdf;
- volatile char *buf;
- volatile smc_uart_t *up;
- char c;
-
- up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_SMC1];
- rbdf = (cbd_t *)&cpmp->cp_dpmem[up->smc_rbase];
-
- /* Wait for character to show up.
- */
- buf = (char *)rbdf->cbd_bufaddr;
- while (rbdf->cbd_sc & BD_SC_EMPTY);
- c = *buf;
- rbdf->cbd_sc |= BD_SC_EMPTY;
-
- return(c);
-}
-
-int
-serial_tstc()
-{
- volatile cbd_t *rbdf;
- volatile smc_uart_t *up;
-
- up = (smc_uart_t *)&cpmp->cp_dparam[PROFF_SMC1];
- rbdf = (cbd_t *)&cpmp->cp_dpmem[up->smc_rbase];
-
- return(!(rbdf->cbd_sc & BD_SC_EMPTY));
-}