[asus-port] a730 (and probably some other pda's) USB host "hack" ; )

From: Serge Nikolaenko <mypal_hh_at_utl.ru>
Date: Fri, 31 Mar 2006 04:18:27 +1100

Usb host becomes non-functional after suspend->resume, but after
HARET it's working (initialized by wince and settings not dropped
by linux kernel and usb host driver, reset is "done" on/by suspend).

So, I've put some code in drivers/usb/host/ohci-pxa27x.c, at the
beginning of ohci_hcd_pxa27x_init function:

static int __init ohci_hcd_pxa27x_init (void)
{
       //printk("UHCREV: 0x%x\n", UHCREV);//0x10

       //PLE may be not set here (wince usbhost disabled ?) and value will be 0x87.
       printk("UHCHCON: 0x%x\n", UHCHCON);//0x97 (USBOPERATIONAL | CLE | PLE | CBSR=0x3)
       //printk("UHCINTS: 0x%x\n", UHCINTS);//0x24
       printk("UHCINTE: 0x%x\n", UHCINTE);//0x80000053 (MIE | RHSC | UE | WDH | SO)
       printk("UHCINTD: 0x%x\n", UHCINTD);//0x80000053 (MIE | RHSC | UE | WDH | SO)
       //printk("UHCHCCA: 0x%x\n", UHCHCCA);//0x0
       //printk("UHCPCED: 0x%x\n", UHCPCED);//0x0
       //printk("UHCCHED: 0x%x\n", UHCCHED);//0x0
       //printk("UHCCCED: 0x%x\n", UHCCCED);//0x0
       //printk("UHCBHED: 0x%x\n", UHCBHED);//0x0
       //printk("UHCBCED: 0x%x\n", UHCBCED);//0x0
       //printk("UHCDHEAD: 0x%x\n", UHCDHEAD);//0x0
       printk("UHCFMI: 0x%x\n", UHCFMI);//0x27782edf

       //these two are counters
       //printk("UHCFMR: 0x%x\n", UHCFMR);//0x2d6b
       //printk("UHCFMN: 0x%x\n", UHCFMN);//0xd1bc

       //intel says, that typical value for that is 0x3e67, wince set
       //this to 0x2a2f
       printk("UHCPERS: 0x%x\n", UHCPERS);//0x2a2f (periodicstart)
       printk("UHCLS: 0x%x\n", UHCLS);0x628 (lsthreshold)
       printk("UHCRHDA: 0x%x\n", UHCRHDA);//0x4001a02 (numberdownstreamports=1 | psm=1 | overcurrentprotection=1 | noovercurrentprotection=1 | powerontopowergoodtime(bit26)=1)
       printk("UHCRHDB: 0x%x\n", UHCRHDB);//0x0
       //printk("UHCRHS: 0x%x\n", UHCRHS);//0x0
       printk("UHCRHPS1: 0x%x\n", UHCRHPS1);//0x100 (port power on)
       printk("UHCRHPS2: 0x%x\n", UHCRHPS2);//0x100 (port power on)
       printk("UHCRHPS3: 0x%x\n", UHCRHPS3);//0x100 (port power on)
       //printk("UHCSTAT: 0x%x\n", UHCSTAT);//0x0
       printk("UHCHR: 0x%x\n", UHCHR);//0x84 (power control polarity low | clock generation reset inactive)
       printk("UHCHIE: 0x%x\n", UHCHIE);//0x0
       printk("UHCHIT: 0x%x\n", UHCHIT);//0x0
...

Some of registers are information-only (they're commented here).
Values I'ge got on my a730 are at the end of each line.

This code gave effect (at the momemnt, paced in
drivers/usb/host/ohci-pxa27x.c, function pxa27x_start_hc), right after
mainstone-dependent block:

#define UHCHCON_HCFS_USBOPERATIONAL (0x2 << 6)
#define UHCHCON_CLE (0x1 << 4) /* Control List Enable */
#define UHCHCON_PLE (0x1 << 2) /* Periodic List Enable */
#define UHCHCON_CBSR41 (0x3 << 0)

#define UHCINT_MIE (0x1 << 31)
#define UHCINT_RHSC (0x1 << 6)
#define UHCINT_UE (0x1 << 4)
#define UHCINT_WDH (0x1 << 1)
#define UHCINT_SO (0x1 << 0)

if (machine_is_a730()) {
        pxa_gpio_mode( 88 | GPIO_ALT_FN_1_IN);
        pxa_gpio_mode( 89 | GPIO_ALT_FN_2_OUT);
        
        UHCHCON = (UHCHCON_HCFS_USBOPERATIONAL | UHCHCON_PLE | UHCHCON_CLE | UHCHCON_CBSR41);
        UHCINTE = (UHCINT_MIE | UHCINT_RHSC | UHCINT_UE | UHCINT_WDH | UHCINT_SO);
        UHCINTD = (UHCINT_MIE | UHCINT_RHSC | UHCINT_UE | UHCINT_WDH | UHCINT_SO);
        UHCFMI = 0x27782edf;
        UHCPERS = 0x3e67;
        UHCLS = 0x628;
        UHCRHDA = 0x4001a02;
        UHCRHDB = 0x0;
        UHCRHS = 0x0;
        UHCRHPS1 = 0x100;
        UHCRHPS2 = 0x100;
        UHCRHPS3 = 0x100;
        UHCSTAT = 0x0;
        UHCHR = (UHCHR_PCPL | UHCHR_CGR);
        UHCHIE = 0x0;
        UHCHIT = 0x0;
}

Usb client need to be tested by suspend/resume.
Received on Thu Mar 30 2006 - 12:18:31 EST

This archive was generated by hypermail 2.2.0 : Thu Mar 30 2006 - 12:18:37 EST