From: Thomas Dahlmann <dahlmann.thomas@arcor.de>
To: Vadim Lobanov <vlobanov@speakeasy.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: amd5536udc interrupts bug
Date: Wed, 14 Jan 2009 13:43:40 +0100 [thread overview]
Message-ID: <496DDDFC.7030301@arcor.de> (raw)
In-Reply-To: <200901131119.54994.vlobanov@speakeasy.net>
Vadim Lobanov schrieb:
> On Saturday 10 January 2009 12:28:20 Thomas Dahlmann wrote:
>
>> UOC has to be enabled. This controller switches the UDC PHY to port 4
>> and owns the mentioned
>> PAD_EN and APU bits. These bits live in the memory mapped register space
>> of UOC. I use a
>> company intern tools to look at memory spaces of PCI devices. Lets
>> forget these bits so far as I am
>> pretty sure that enabling UOC fixes the problem.
>>
>
> I've managed to get at some values that look suspiciously like the UOC
> register space, and they seem to be OK.
>
> Here is the full description of what I did, so that google can slurp this
> information up for others to use in the future. First things first, the AMD
> Geode CS5536 Companion Device Data Book is a necessary resource, and tells us
> where the the UOC-related MSR lives, how big the UOC register space is, and
> what all the bits mean.
>
> Armed with this data, we first grab the UOC MSR:
>
> [root@hurricane ~]# modprobe msr
> [root@hurricane ~]# rdmsr 0x5120000B
> aefa06000
>
> We note the UOC base address value, which, according to the data book, is in
> bits 31:8 of the MSR. Using this information and a few more looks into the
> data book, we get the following kernel code:
>
> #define UOC_REGISTERS_ADDR 0xEFA06000
> #define UOC_REGISTERS_SIZE 0x0100
>
> struct uoc_registers {
> u32 cap;
> u32 mux;
> u32 reserved;
> u32 ctl;
> } __attribute__((packed));
>
> static void observe_uoc_registers(void)
> {
> struct uoc_registers __iomem *uoc;
>
> if (!request_mem_region(UOC_REGISTERS_ADDR,
> UOC_REGISTERS_SIZE,
> "amd5536uoc")) {
> printk(KERN_INFO "amd5536uoc mem region already used\n");
> goto finish;
> }
> uoc = ioremap_nocache(UOC_REGISTERS_ADDR,
> UOC_REGISTERS_SIZE);
> if (uoc == NULL) {
> printk(KERN_INFO "amd5536uoc io memory cannot be mapped\n");
> goto release;
> }
> printk(KERN_INFO "amd5536uoc cap=0x%08X\n", readl(&uoc->cap));
> printk(KERN_INFO "amd5536uoc mux=0x%08X\n", readl(&uoc->mux));
> printk(KERN_INFO "amd5536uoc ctl=0x%08X\n", readl(&uoc->ctl));
> iounmap(uoc);
> release:
> release_mem_region(UOC_REGISTERS_ADDR,
> UOC_REGISTERS_SIZE);
> finish:
> printk(KERN_INFO "amd5536uoc observation finished\n");
> }
>
> Put a call to observe_uoc_registers() at the top of udc_pci_probe(), rebuild,
> modprobe the amd5536udc driver, and observe the data. Namely, the values that
> came back, as well as their interpreted meanings according to the data book,
> are:
>
> cap=0x000083EA
> The host power control bits affect USB_PWR_EN1 for ports 1-3.
> The host power control bits affect USB_PWR_EN2 for port 4.
> Port power enabled with output of 1 on USB_PWR_EN1 and USB_PWR_EN2.
> No overcurrent reporting.
> Automatic pull-up (APU) is enabled.
>
> mux=0x00000003
> The muxed port is assigned to the device controller.
>
> ctl=0x00000083
> The muxed port is assigned to the device controller.
> The comparator circuitry for VBUS detection (PADEN) is enabled.
>
> The mystery deepens. :)
>
> -- Vadim Lobanov
>
>
Beside reading the MSR register for UOC_REGISTERS_ADDR
it should be possible to use BAR0 of UOC PCI config
space (if UOC enabled in BIOS).
The UOC registers look good to me too except for bit VBUSVLD
(bit 8 in UOCMUX). This bit should get set when cable is
connected. Maybe VBUS pin is not connected. In this case the
internal pull up will not get connected. For testing the pull up can
be connected manually by clearing APU in UOCCAP and
setting PUEN in UOCMUX.
There is one remaining bit which could prevent the physical USB
connection. It is bit SD (soft disconnect) in UDC DEVCTL
register (bit 10). This bit has to be cleared. This is done by
usb_gadget_register_driver() in amd5536udc.c. This function is
called by gadget driver like g_zero when gagdet driver loads.
Maybe you want add a printk() there to check that the bit was
cleared. Furthermore it could help to enable DEBUG and
#define UDC_VERBOSE in amd5536udc.c to have a closer
look at what UDC driver is doing.
But if SD bit is cleared (and UOC bits seem OK as you showed)
then only hardware can be the root cause of the issue. If host
detects a USB connection it will automatically send a
GET_DESCRIPTOR message to UDC. You would see kernel
messages on host side, at least messages indicating that device
is not responding.
I found a Hurricane LX800 manual at
http://www.lippert-at.de/fileadmin/lippert-at/products/EPIC/Hurricane-LX800/TME-EPIC-HURLX-R1V4.pdf
saying that there is no type B device port and device port is port 3.
Do you have a different one?
Chapter 3.8, page 19:
4 standard USB 2.0 host ports are provided at the I/O panel
of the Hurricane LX800. . . Port 3 can be used as USB device
port. This feature must be enabled in BIOS
under Motherboard Device Configuration -> PCI Configuration.
UDC must be enabled; Port 3 assignment should be set to device.
Thomas
next prev parent reply other threads:[~2009-01-14 12:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <49661E83.2070703@arcor.de>
2009-01-08 16:40 ` amd5536udc interrupts bug Thomas Dahlmann
2009-01-08 18:27 ` Vadim Lobanov
2009-01-09 2:02 ` Vadim Lobanov
2009-01-09 11:41 ` Thomas Dahlmann
2009-01-09 22:40 ` Vadim Lobanov
2009-01-10 20:28 ` Thomas Dahlmann
2009-01-12 19:02 ` Vadim Lobanov
2009-01-13 19:19 ` Vadim Lobanov
2009-01-14 12:43 ` Thomas Dahlmann [this message]
2009-01-14 22:49 ` Vadim Lobanov
2009-01-15 9:26 ` Thomas Dahlmann
2009-01-17 0:17 ` Vadim Lobanov
2009-01-19 12:23 ` Thomas Dahlmann
2009-01-07 23:10 Vadim Lobanov
2009-01-08 2:32 ` Robert Hancock
2009-01-08 3:30 ` Vadim Lobanov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=496DDDFC.7030301@arcor.de \
--to=dahlmann.thomas@arcor.de \
--cc=linux-kernel@vger.kernel.org \
--cc=vlobanov@speakeasy.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox