Subject: Re: [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko

From: Albert Herranz <[email-masked]>
Date: Tue, 24 Nov 2009 19:19:52 +0100

Segher Boessenkool wrote:
> You set up DBAT1 here...
> 
>> +setup_usbgecko_bat:
>> +    /* prepare a BAT for early io */
>> +    lis    r8, 0x0c00
>> +    ori    r8, r8, 0x002a    /* uncached, guarded ,rw */
>> +    lis    r11, 0xcc00
>> +    ori    r11, r11, 0x3    /* 128K */
>> +#ifdef CONFIG_WII
>> +    oris    r8, r8, 0x0100
>> +    oris    r11, r11, 0x0100
>> +#endif
>> +    mtspr    SPRN_DBAT1L, r8
>> +    mtspr    SPRN_DBAT1U, r11
>> +    sync
>> +    isync
>> +    blr
> 
> ... and again here:
> 
>> +void __init udbg_init_usbgecko(void)
>> +{
>> +    unsigned long vaddr, paddr;
>> +
>> +#if defined(CONFIG_GAMECUBE)
>> +    paddr = 0x0c000000;
>> +#elif defined(CONFIG_WII)
>> +    paddr = 0x0d000000;
>> +#else
>> +#error Invalid platform for USB Gecko based early debugging.
>> +#endif
>> +
>> +    vaddr = 0xc0000000 | paddr;
>> +    setbat(1, vaddr, paddr, 128*1024, PAGE_KERNEL_NCG);
> 
> Do you need to do it twice?
> 

Uhmm... I need to re-check it.
IIRC the BATs were re-initialized in between. But I'm not sure now :)

>> +    ug_io_base = (void __iomem *)(vaddr | 0x6814);
> 
> Oh, hardcoded slot2, now i'm confused which one should be it :-)
> 

early udbg  : hardcoded to mem2 slot
normal udbg : as specified in device tree

Clearer now ? ;)

Thanks for the review!
Albert