From: Albert H. <he...@us...> - 2008-03-26 19:58:25
|
Update of /cvsroot/gc-linux/linux/arch/powerpc/boot In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv10959/arch/powerpc/boot Modified Files: Makefile gamecube.c Log Message: Simplify bootwrapper. Moved out ugecon code. The zImage.gamecube target is used for both gamecube and wii platforms. Index: gamecube.c =================================================================== RCS file: /cvsroot/gc-linux/linux/arch/powerpc/boot/gamecube.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- gamecube.c 4 Mar 2008 06:20:54 -0000 1.1 +++ gamecube.c 26 Mar 2008 19:58:28 -0000 1.2 @@ -1,7 +1,7 @@ /* * arch/powerpc/boot/gamecube.c * - * Nintendo GameCube boot + * Nintendo GameCube/Wii platforms * Copyright (C) 2004-2008 The GameCube Linux Team * Copyright (C) 2008 Albert Herranz * @@ -18,13 +18,10 @@ #include "io.h" #include "ops.h" -/* - * Note that CONFIG_* defines are not available at this stage, except: - * - CONFIG_USBGECKO_EARLY_CONSOLE - * - CONFIG_GAMECUBE_WII - */ +#include "ugecon.h" -BSS_STACK(4096); + +BSS_STACK(8192); /* * We enter with the MMU enabled and some legacy memory mappings active. @@ -65,157 +62,31 @@ b _zimage_start_lib\n\ "); -#ifdef CONFIG_USBGECKO_EARLY_CONSOLE - -#ifdef CONFIG_GAMECUBE_WII -#define EXI_BASE (0xcd006800) -#else -#define EXI_BASE (0xcc006800) -#endif - -#define EXI_CHANNEL_SPACING 0x14 - -#define EXI_IO_BASE(c) ((void *)(EXI_BASE + ((c)*EXI_CHANNEL_SPACING))) - -#define EXI_CLK_32MHZ 5 - -#define EXI_CSR 0x00 -#define EXI_CSR_CLKMASK (0x7<<4) -#define EXI_CSR_CLK_32MHZ (EXI_CLK_32MHZ<<4) -#define EXI_CSR_CSMASK (0x7<<7) -#define EXI_CSR_CS_0 (0x1<<7) /* Chip Select 001 */ - -#define EXI_CR 0x0c -#define EXI_CR_TSTART (1<<0) -#define EXI_CR_WRITE (1<<2) -#define EXI_CR_READ_WRITE (2<<2) -#define EXI_CR_TLEN(len) (((len)-1)<<4) - -#define EXI_DATA 0x10 - - -/* - * - */ -static int ug_check_adapter(void) -{ - u32 *csr_reg = EXI_IO_BASE(1) + EXI_CSR; - u32 *data_reg = EXI_IO_BASE(1) + EXI_DATA; - u32 *cr_reg = EXI_IO_BASE(1) + EXI_CR; - u32 csr, data, cr; - - /* select */ - csr = EXI_CSR_CLK_32MHZ | EXI_CSR_CS_0; - out_be32(csr_reg, csr); - - /* read/write */ - data = 0x90000000; - out_be32(data_reg, data); - cr = EXI_CR_TLEN(2) | EXI_CR_READ_WRITE | EXI_CR_TSTART; - out_be32(cr_reg, cr); - - while(in_be32(cr_reg) & EXI_CR_TSTART) - barrier(); - - /* deselect */ - out_be32(csr_reg, 0); - - data = in_be32(data_reg); - return (data == 0x04700000); -} - -/* - * - */ -static int ug_is_txfifo_empty(void) -{ - u32 *csr_reg = EXI_IO_BASE(1) + EXI_CSR; - u32 *data_reg = EXI_IO_BASE(1) + EXI_DATA; - u32 *cr_reg = EXI_IO_BASE(1) + EXI_CR; - u32 csr, data, cr; - - /* select */ - csr = EXI_CSR_CLK_32MHZ | EXI_CSR_CS_0; - out_be32(csr_reg, csr); - - /* read/write */ - data = 0xC0000000; - out_be32(data_reg, data); - cr = EXI_CR_TLEN(2) | EXI_CR_READ_WRITE | EXI_CR_TSTART; - out_be32(cr_reg, cr); - - while(in_be32(cr_reg) & EXI_CR_TSTART) - barrier(); - - /* deselect */ - out_be32(csr_reg, 0); - - data = in_be32(data_reg); - return (data & 0x04000000); -} - /* * */ -static void ug_putc(char ch) -{ - u32 *csr_reg = EXI_IO_BASE(1) + EXI_CSR; - u32 *data_reg = EXI_IO_BASE(1) + EXI_DATA; - u32 *cr_reg = EXI_IO_BASE(1) + EXI_CR; - u32 csr, data, cr; - - /* select */ - csr = EXI_CSR_CLK_32MHZ | EXI_CSR_CS_0; - out_be32(csr_reg, csr); - - /* write */ - data = 0xb0000000 | (ch << 20); - out_be32(data_reg, data); - cr = EXI_CR_TLEN(2) | EXI_CR_WRITE | EXI_CR_TSTART; - out_be32(cr_reg, cr); - - while(in_be32(cr_reg) & EXI_CR_TSTART) - barrier(); - - /* deselect */ - out_be32(csr_reg, 0); -} - -/* - * - */ -void ug_early_putc(char ch) -{ - int tries = 10; - while(!ug_is_txfifo_empty() && tries--) - barrier(); - ug_putc(ch); -} - - static void gamecube_console_write(const char *buf, int len) { char *b = (char *)buf; while(len--) { if (*b == '\n') - ug_early_putc('\r'); - ug_early_putc(*b++); + ug_putc('\r'); + ug_putc(*b++); } } -#endif /* CONFIG_USBGECKO_EARLY_CONSOLE */ - +/* + * + */ void platform_init(unsigned long r3, unsigned long r4, unsigned long r5) { - u32 heapsize = 0x01654000 - (u32)_end; - -#ifdef CONFIG_USBGECKO_EARLY_CONSOLE - if (ug_check_adapter()) - console_ops.write = gamecube_console_write; -#endif + u32 heapsize = 16*1024*1024 - (u32)_end; simple_alloc_init(_end, heapsize, 32, 64); ft_init(_dtb_start, 0, 4); + + if (!ug_grab_io_base() && ug_is_adapter_present()) + console_ops.write = gamecube_console_write; } Index: Makefile =================================================================== RCS file: /cvsroot/gc-linux/linux/arch/powerpc/boot/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile 4 Mar 2008 06:20:54 -0000 1.1 +++ Makefile 26 Mar 2008 19:58:28 -0000 1.2 @@ -35,13 +35,6 @@ BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) -extra-defs-$(CONFIG_GAMECUBE) += -DCONFIG_GAMECUBE -extra-defs-$(CONFIG_GAMECUBE_WII) += -DCONFIG_GAMECUBE_WII -extra-defs-$(CONFIG_USBGECKO_EARLY_CONSOLE) += -DCONFIG_USBGECKO_EARLY_CONSOLE - -BOOTCFLAGS += $(extra-defs-y) -BOOTAFLAGS += $(extra-defs-y) - $(obj)/4xx.o: BOOTCFLAGS += -mcpu=440 $(obj)/ebony.o: BOOTCFLAGS += -mcpu=440 $(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405 @@ -58,15 +51,12 @@ gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \ mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \ cpm-serial.c stdlib.c mpc52xx-psc.c planetcore.c uartlite.c \ - fsl-soc.c mpc8xx.c pq2.c + fsl-soc.c mpc8xx.c pq2.c ugecon.c src-plat := of.c cuboot-52xx.c cuboot-83xx.c cuboot-85xx.c holly.c \ cuboot-ebony.c treeboot-ebony.c prpmc2800.c \ treeboot-bamboo.c cuboot-8xx.c \ cuboot-pq2.c cuboot-sequoia.c cuboot-bamboo.c \ - fixed-head.S ep88xc.c cuboot-hpc2.c - -src-plat-$(CONFIG_GAMECUBE) += gamecube.c -src-plat += $(src-plat-y) + fixed-head.S ep88xc.c cuboot-hpc2.c gamecube.c src-boot := $(src-wlib) $(src-plat) empty.c @@ -157,6 +147,7 @@ image-$(CONFIG_PPC_PRPMC2800) += zImage.prpmc2800 image-$(CONFIG_PPC_ISERIES) += zImage.iseries image-$(CONFIG_GAMECUBE) += zImage.gamecube +image-$(CONFIG_WII) += zImage.gamecube image-$(CONFIG_DEFAULT_UIMAGE) += uImage ifneq ($(CONFIG_DEVICE_TREE),"") |