tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Fixing the ubsa driver



On Fri, Jul 11, 2008 at 10:06:31PM +0200, Frank Wille wrote:
> Hi!
> 
> Since beginning of this year the ubsa driver has ceased working, and I was
> trying to find the reasons since quite some time. I am using an Option N.V.
> MC3G card for testing.
> 
> Today I would say that there are at least two bugs.
> 
> The first was already mentioned in this thread from February:
>   http://mail-index.netbsd.org/current-users/2008/02/04/msg000760.html
> Chavdar Ivanov and me both reported an NMI (entering the debugger) when
> inserting a cardbus card in our HP NX6310.
> 
> With my card it looked like
> 
> ohci0 at cardbus0 function 0: vendor 0x1045 product 0xc861 (rev. 0x10)
> NMI ... going to debugger
> > cont
> ohci0: interrupting at 10
> ohci0: OHCI version 1.0, legacy support
> usb5 at ohci0: USB revision 1.0
> uhub5 at usb5
> uhub5: Opti OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
> uhub5: 2 ports with 2 removable, self powered
> ugen0 at uhub5 port 1
> ugen0: Vodafone Vodafone Mobile Connect Card - 3G, rev 2.00/0.00, addr 2
> [...]
> 
> I solved the NMI problem by the following hack in ohci_cardbus_attach():
> 
> --- cardbus/CVS/Base/ohci_cardbus.c     2008-06-28 14:09:48.000000000 +0200
> +++ cardbus/ohci_cardbus.c      2008-07-11 21:26:17.000000000 +0200
> @@ -132,8 +132,10 @@
>         }
>  
>         /* Disable interrupts, so we don't can any spurious ones. */
> +#if 0
>         bus_space_write_4(sc->sc.iot, sc->sc.ioh, OHCI_INTERRUPT_DISABLE,
>                           OHCI_ALL_INTRS);
> +#endif
>  
>         sc->sc_cc = cc;
>         sc->sc_cf = cf;
> 
> This is certainly plain wrong. But it helps for the moment. Maybe somebody
> else has a better idea what to investigate?

Now that I'm looking at ohci_cardbus_attach(), there are some obvious
problems.  All of this code should run before we attempt to read/write
any registers:

        (ct->ct_cf->cardbus_ctrl)(cc, CARDBUS_MEM_ENABLE);
        (ct->ct_cf->cardbus_ctrl)(cc, CARDBUS_BM_ENABLE);

        /* Enable the device. */
        csr = cardbus_conf_read(cc, cf, ca->ca_tag,
                                CARDBUS_COMMAND_STATUS_REG);
        cardbus_conf_write(cc, cf, ca->ca_tag, CARDBUS_COMMAND_STATUS_REG,
                       csr | CARDBUS_COMMAND_MASTER_ENABLE
                           | CARDBUS_COMMAND_MEM_ENABLE);

I will move the bus_space_write_4() call to right above the call to
cardbus_intr_establish(), and check that in.

Dave

-- 
David Young             OJC Technologies
dyoung%ojctech.com@localhost      Urbana, IL * (217) 278-3933 ext 24


Home | Main Index | Thread Index | Old Index