Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177666
b: refs/heads/master
c: d1d56f8
h: refs/heads/master
v: v3
  • Loading branch information
Albert Herranz authored and Grant Likely committed Dec 13, 2009
1 parent 69008b3 commit 803b301
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b8e8efaa86399c4424becd96402993cf230dab57
refs/heads/master: d1d56f8c1d5a622228177eca47e9dcff0498bddb
8 changes: 8 additions & 0 deletions trunk/arch/powerpc/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,14 @@ config PPC_EARLY_DEBUG_CPM
using a CPM-based serial port. This assumes that the bootwrapper
has run, and set up the CPM in a particular way.

config PPC_EARLY_DEBUG_USBGECKO
bool "Early debugging through the USB Gecko adapter"
depends on GAMECUBE_COMMON
select USBGECKO_UDBG
help
Select this to enable early debugging for Nintendo GameCube/Wii
consoles via an external USB Gecko adapter.

endchoice

config PPC_EARLY_DEBUG_44x_PHYSLOW
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/powerpc/include/asm/udbg.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ extern void __init udbg_init_btext(void);
extern void __init udbg_init_44x_as1(void);
extern void __init udbg_init_40x_realmode(void);
extern void __init udbg_init_cpm(void);
extern void __init udbg_init_usbgecko(void);

#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_UDBG_H */
25 changes: 25 additions & 0 deletions trunk/arch/powerpc/kernel/head_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ __after_mmu_off:
#ifdef CONFIG_PPC_EARLY_DEBUG_CPM
bl setup_cpm_bat
#endif
#ifdef CONFIG_PPC_EARLY_DEBUG_USBGECKO
bl setup_usbgecko_bat
#endif

/*
* Call setup_cpu for CPU 0 and initialize 6xx Idle
Expand Down Expand Up @@ -1203,6 +1206,28 @@ setup_cpm_bat:
blr
#endif

#ifdef CONFIG_PPC_EARLY_DEBUG_USBGECKO
setup_usbgecko_bat:
/* prepare a BAT for early io */
#if defined(CONFIG_GAMECUBE)
lis r8, 0x0c00
#elif defined(CONFIG_WII)
lis r8, 0x0d00
#else
#error Invalid platform for USB Gecko based early debugging.
#endif
/*
* The virtual address used must match the virtual address
* associated to the fixmap entry FIX_EARLY_DEBUG_BASE.
*/
lis r11, 0xfffe /* top 128K */
ori r8, r8, 0x002a /* uncached, guarded ,rw */
ori r11, r11, 0x2 /* 128K, Vs=1, Vp=0 */
mtspr SPRN_DBAT1L, r8
mtspr SPRN_DBAT1U, r11
blr
#endif

#ifdef CONFIG_8260
/* Jump into the system reset for the rom.
* We first disable the MMU, and then jump to the ROM reset address.
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/powerpc/kernel/udbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ void __init udbg_early_init(void)
udbg_init_40x_realmode();
#elif defined(CONFIG_PPC_EARLY_DEBUG_CPM)
udbg_init_cpm();
#elif defined(CONFIG_PPC_EARLY_DEBUG_USBGECKO)
udbg_init_usbgecko();
#endif

#ifdef CONFIG_PPC_EARLY_DEBUG
Expand Down
56 changes: 56 additions & 0 deletions trunk/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <asm/io.h>
#include <asm/prom.h>
#include <asm/udbg.h>
#include <asm/fixmap.h>

#include "usbgecko_udbg.h"

Expand Down Expand Up @@ -270,3 +271,58 @@ void __init ug_udbg_init(void)
of_node_put(np);
return;
}

#ifdef CONFIG_PPC_EARLY_DEBUG_USBGECKO

static phys_addr_t __init ug_early_grab_io_addr(void)
{
#if defined(CONFIG_GAMECUBE)
return 0x0c000000;
#elif defined(CONFIG_WII)
return 0x0d000000;
#else
#error Invalid platform for USB Gecko based early debugging.
#endif
}

/*
* USB Gecko early debug support initialization for udbg.
*/
void __init udbg_init_usbgecko(void)
{
void __iomem *early_debug_area;
void __iomem *exi_io_base;

/*
* At this point we have a BAT already setup that enables I/O
* to the EXI hardware.
*
* The BAT uses a virtual address range reserved at the fixmap.
* This must match the virtual address configured in
* head_32.S:setup_usbgecko_bat().
*/
early_debug_area = (void __iomem *)__fix_to_virt(FIX_EARLY_DEBUG_BASE);
exi_io_base = early_debug_area + 0x00006800;

/* try to detect a USB Gecko */
if (!ug_udbg_probe(exi_io_base))
return;

/* we found a USB Gecko, load udbg hooks */
udbg_putc = ug_udbg_putc;
udbg_getc = ug_udbg_getc;
udbg_getc_poll = ug_udbg_getc_poll;

/*
* Prepare again the same BAT for MMU_init.
* This allows udbg I/O to continue working after the MMU is
* turned on for real.
* It is safe to continue using the same virtual address as it is
* a reserved fixmap area.
*/
setbat(1, (unsigned long)early_debug_area,
ug_early_grab_io_addr(), 128*1024, PAGE_KERNEL_NCG);
}

#endif /* CONFIG_PPC_EARLY_DEBUG_USBGECKO */

2 changes: 2 additions & 0 deletions trunk/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ static inline void __init ug_udbg_init(void)

#endif /* CONFIG_USBGECKO_UDBG */

void __init udbg_init_usbgecko(void);

#endif /* __USBGECKO_UDBG_H */

0 comments on commit 803b301

Please sign in to comment.