amd5536udc interrupts bug
Quoted 10 lines
Quoted 6 lines · Vadim Lobanov
It is my understanding that a handler for a shared interrupt can be invoked at any time after the corresponding
request_irq()call is made, simply because some other device on the same interrupt may already be active. This leaves us with a very noticeable race condition, whereudc_irq()can be invoked with uninitialized 'dev' data.Yes, your analysis appears correct.
Ah, right. Thanks for your analysis! Never ran into this condition as on the Geode systems I had the IRQ is shared between UDC and UOC/OTG (both on the CS5536 chip) and UOC never fires interrupts while UDC driver is loaded as both drivers (UOC/OTG driver is not in the kernel yet) register each other which makes sure that interrupts are enabled after udc_pci_probe().
Quoted 6 lines
Quoted 4 lines
more complicated fix may be to try to shuffle all the code around to make sure that 'dev' is fully initialized before we request the irq, but I don't understand the code well enough (yet) to comfortably do this.
Yeah, that's the proper fix.
I could provide a fix within the next weeks. Currently I move to another company and have no hardware to test it.
Maybe you want to try this. It should work to place the register init from udc_probe()
/* udc csr registers base */dev->csr = dev->virt_addr + UDC_CSR_ADDR;
/* dev registers base */dev->regs = dev->virt_addr + UDC_DEVCFG_ADDR;
/* ep registers base */dev->ep_regs = dev->virt_addr + UDC_EPREGS_ADDR;
/* fifo's base */dev->rxfifo = (u32 __iomem *)(dev->virt_addr + UDC_RXFIFO_ADDR); dev->txfifo = (u32 __iomem *)(dev->virt_addr + UDC_TXFIFO_ADDR);
just before request_irq(...) to allow the interrupt handler to read the interrupt status registers.
Thomas
Quoted 2 lines · On Thursday 08 January 2009 08:40:28 Thomas Dahlmann wrote:
Ah, right. Thanks for your analysis! Never ran into this condition as on the Geode systems I had the IRQ is shared between UDC and
UOC/OTG
Quoted 2 lines
(both on the CS5536 chip) and UOC never fires interrupts while UDC driver is loaded as both drivers (UOC/OTG driver is not in the kernel
yet)
Quoted 2 lines
register each other which makes sure that interrupts are enabled after
udc_pci_probe().
Ok, I understand.
Quoted 3 lines
I could provide a fix within the next weeks. Currently I move to another company and
have no hardware to test it.
No worries. :) I can also test your patches on my board here, if it helps any.
Quoted 13 lines
Maybe you want to try this. It should work to place the register init from
udc_probe()/* udc csr registers base */
dev->csr=dev->virt_addr+UDC_CSR_ADDR;
/* dev registers base */dev->regs=dev->virt_addr+UDC_DEVCFG_ADDR;
/* ep registers base */dev->ep_regs=dev->virt_addr+UDC_EPREGS_ADDR;
/* fifo's base */dev->rxfifo= (u32__iomem*)(dev->virt_addr +UDC_RXFIFO_ADDR);dev->txfifo= (u32__iomem*)(dev->virt_addr +UDC_TXFIFO_ADDR);
Quoted 3 lines
just before
request_irq(...)to allow the interrupt handler to read the interrupt status
registers.
I'll slip this into the next kernel build and see what happens. Thanks!
-- Vadim Lobanov
Quoted 13 lines · On Thursday 08 January 2009 08:40:28 Thomas Dahlmann wrote:
Maybe you want to try this. It should work to place the register init from
udc_probe()/* udc csr registers base */
dev->csr=dev->virt_addr+UDC_CSR_ADDR;
/* dev registers base */dev->regs=dev->virt_addr+UDC_DEVCFG_ADDR;
/* ep registers base */spin_lock_init(&dev->lock);dev->ep_regs=dev->virt_addr+UDC_EPREGS_ADDR;
/* fifo's base */dev->rxfifo= (u32__iomem*)(dev->virt_addr +UDC_RXFIFO_ADDR);dev->txfifo= (u32__iomem*)(dev->virt_addr +UDC_TXFIFO_ADDR);
Quoted 3 lines
just before
request_irq(...)to allow the interrupt handler to read the interrupt status
registers.
I did this. Actually, I also yanked the "spin_lock_init(&dev->lock)" bit before the request_irq() as well, since that field was also obviously needed for the irq routine. (I didn't check for any other necessary but less-obvious fields.) With these changes, the module modprobes just fine.
Alas, the hardware doesn't work. When I try plugging in the other end of the USB cable, absolutely nothing happens. Not even an interrupt:/proc/interrupts for the amd5536udc line stays at zero. Any thoughts on possible ways to tackle this / what could be going wrong / etc?
-- Vadim Lobanov
Quoted 15 lines · Vadim Lobanov
Quoted 13 lines · On Thursday 08 January 2009 08:40:28 Thomas Dahlmann wrote:
Maybe you want to try this. It should work to place the register init from
udc_probe()/* udc csr registers base */
dev->csr=dev->virt_addr+UDC_CSR_ADDR;
/* dev registers base */dev->regs=dev->virt_addr+UDC_DEVCFG_ADDR;
/* ep registers base */spin_lock_init(&dev->lock);dev->ep_regs=dev->virt_addr+UDC_EPREGS_ADDR;
/* fifo's base */dev->rxfifo= (u32__iomem*)(dev->virt_addr +UDC_RXFIFO_ADDR);dev->txfifo= (u32__iomem*)(dev->virt_addr +UDC_TXFIFO_ADDR);
Quoted 7 lines
Quoted 4 lines
just before
request_irq(...)to allow the interrupt handler to read the interrupt status
registers.I did this. Actually, I also yanked the "
spin_lock_init(&dev->lock)" bit before therequest_irq()as well, since that field was also obviously needed for the irq routine. (I didn't check for any other necessary but less-obvious fields.) With these changes, the module modprobes just fine.
Thanks for the test!
Quoted 2 lines
Alas, the hardware doesn't work. When I try plugging in the other end of the USB cable, absolutely nothing happens. Not even an interrupt:
/proc/interruptsfor the amd5536udc line stays at zero. Any thoughts on possible ways to tackle this / what could be going wrong / etc?
Is there any output in the kernel messages on the host side complaining about that device is not answering? If not than USB device port is probably not connected to UDC PHY. Please check in BIOS setup that port 4 is assigned to UDC.
This will set bits PAD_EN and APU in UOC controller (DEVID 0x2097):
http://www.amd.com/files/connectivitysolutions/geode/geode_lx/33238G_cs5536_db.pdf
Thomas
Quoted 3 lines
-- Vadim Lobanov
Quoted 5 lines · On Friday 09 January 2009 03:41:21 Thomas Dahlmann wrote:
Quoted 4 lines · Vadim Lobanov
Alas, the hardware doesn't work. When I try plugging in the other end of the USB cable, absolutely nothing happens. Not even an interrupt:
/proc/interruptsfor the amd5536udc line stays at zero. Any thoughts on possible ways to tackle this / what could be going wrong / etc?
Just realized that I forgot to mention that I do also have g_zero sitting on top of amd5536udc, so there should at least be a dummy USB device to enumerate.
Quoted 5 lines
Is there any output in the kernel messages on the host side complaining about that device is
not answering? If not than USB device port is probably not connected to UDC PHY. Please
check in BIOS setup that port 4 is assigned to UDC.
Nope, nothing at all shows up in the logs or the interrupt counts when the cable is plugged, neither for the host drivers nor the device drivers. (The quickest test I have is to hook the device up to itself - one A port and one B port.)
The BIOS is configured "correctly" if the manuals are to be trusted. Here are the relevant settings
OHCI: Enabled
EHCI: Enabled
UDC: Enabled
UOC: Disabled
Overcurrent reporting: Disabled
Port 4 assignment: Device
Quoted 2 lines
This will set bits
PAD_ENand APU in UOC controller (DEVID0x2097):
http://www.amd.com/files/connectivitysolutions/geode/geode_lx/33238G_cs5536
Quoted 1 line
_db.pdf
Please pardon my ignorance, but what would be the best way to check if these bits are set?
Thanks.
Quoted 4 lines · Vadim Lobanov
Quoted 2 lines · On Friday 09 January 2009 03:41:21 Thomas Dahlmann wrote:
Vadim Lobanov schrieb:
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
Alas, the hardware doesn't work. When I try plugging in the other end of the USB cable, absolutely nothing happens. Not even an interrupt:
/proc/interruptsfor the amd5536udc line stays at zero. Any thoughts on possible ways to tackle this / what could be going wrong / etc?Just realized that I forgot to mention that I do also have
g_zerositting on top of amd5536udc, so there should at least be a dummy USB device to enumerate.
Right, g_zero should enumerate. It also provides data sink/source and loopback functionality. If you want to test data traffic then g_file_storage would be a good choice as it behaves as a mass storage device.
Example:
dd bs=1M count=64 if=/dev/zero of=/tmp/image_file
modrobe g_file_storage file=/tmp/image_file
(create partition and file system from host side)
Quoted 9 lines
Quoted 6 lines
Is there any output in the kernel messages on the host side complaining about that device is
not answering? If not than USB device port is probably not connected to UDC PHY. Please
check in BIOS setup that port 4 is assigned to UDC.Nope, nothing at all shows up in the logs or the interrupt counts when the cable is plugged, neither for the host drivers nor the device drivers. (The quickest test I have is to hook the device up to itself - one A port and one B port.)
Quoted 8 lines
The BIOS is configured "correctly" if the manuals are to be trusted. Here are the relevant settings
OHCI: Enabled
EHCI: Enabled
UDC: Enabled
UOC: Disabled
Overcurrent reporting: Disabled
Port 4 assignment: Device
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.
Thomas
Quoted 15 lines · On Saturday 10 January 2009 12:28:20 Thomas Dahlmann wrote:
Quoted 5 lines · Vadim Lobanov
Nope, nothing at all shows up in the logs or the interrupt counts when the cable is plugged, neither for the host drivers nor the device drivers. (The quickest test I have is to hook the device up to itself - one A port and one B port.)
Quoted 8 lines
The BIOS is configured "correctly" if the manuals are to be trusted. Here are the relevant settings
OHCI: Enabled
EHCI: Enabled
UDC: Enabled
UOC: Disabled
Overcurrent reporting: Disabled
Port 4 assignment: Device
Quoted 7 lines
UOC has to be enabled. This controller switches the UDC PHY to port 4 and owns the mentioned
PAD_ENand 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.
That'll teach me for trusting the board vendor's documentation. :)
[ ... doing some tests ... ]
Unfortunately, however, even enabling UOC in the BIOS does not make the USB connection work. The symptoms are exactly the same as before.
I'm going to try to figure out how to get at those two bits, and also will start talking with the board vendor as well (since it's starting to look more and more like a BIOS and/or HW problem).
Thanks for your help so far!
Quoted 7 lines · 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_ENand 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 0x5120000Baefa06000
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
Quoted 72 lines · Vadim Lobanov
Quoted 8 lines · 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_ENand 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 ~]# rdmsr0x5120000Baefa06000We 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_ADDR0xEFA06000
#defineUOC_REGISTERS_SIZE0x0100struct 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 ofudc_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 affectUSB_PWR_EN1for ports 1-3. The host power control bits affectUSB_PWR_EN2for port 4. Port power enabled with output of 1 onUSB_PWR_EN1andUSB_PWR_EN2. No overcurrent reporting.
Automatic pull-up (APU) is enabled.mux=0x00000003
The muxed port is assigned to the device controller.
Quoted 9 lines
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
Quoted 15 lines · On Wednesday 14 January 2009 04:43:40 Thomas Dahlmann wrote:
Quoted 7 lines · Vadim Lobanov
cap=0x000083EA
The host power control bits affectUSB_PWR_EN1for ports 1-3. The host power control bits affectUSB_PWR_EN2for port 4. Port power enabled with output of 1 onUSB_PWR_EN1andUSB_PWR_EN2. No overcurrent reporting.
Automatic pull-up (APU) is enabled.Quoted 6 lines
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.
Quoted 6 lines
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.
I modprobed the driver before plugging in the cable, so that would explain the VBUSVLD bit not being set.
Quoted 6 lines
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_DESCRIPTORmessage to UDC. You would see kernel messages on host side, at least messages indicating that device is not responding.
It seems that the ultimate cause for all this strangeness was a mis-wired
board: the vendor at long last admitted that the VBUS signal is not connected in the hardware. Why they didn't simply document this fact, and thereby save me a lot of wasted effort, remains a mystery.
As a workaround, they suggested setting bit 0x00000010 in the ctl register, which is strangely enough inside the "reserved" space according to the AMD data book. Worth a shot, I thought. After hacking up the amd5536udc driver even more to do this operation at load time, the register states change to:
cap=0x000083EA
mux=0x00000007
ctl=0x00000193
Seems that a few other "reserved" bits also raised in response. (I still do not understand exactly how they wired up the CS5536 IO chip to be different from the data book, but oh well.) In this mode, the USB link is finally detected, and the board is finally able to enumerate itself as a g_zero device.
Please accept my sincere thank-you for your help. I'm hoping that everything will work from now on, and that I won't send any more questions your way. :) I'll also await an update to the irq stuff in the amd5536udc driver that we talked about earlier, if you get around to making the fix for it first.
Quoted 7 lines
I found a Hurricane LX800 manual at
http://www.lippert-at.de/fileadmin/lippert-at/products/EPIC/Hurricane-LX800
/TME-EPIC-HURLX-R1V4.pdfsaying that there is no type B device port and device port is port 3. Do you have a different one?
Yep, that's the one. We're using a USB A-to-B adapter to turn port 3 from an A port to a B-port. The standard USB cable uses this adapter.
Quoted 6 lines
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.
See how they conveniently forgot to mention UOC in their description, much less some magical bit in the ctl register? Tricky, tricky! :)
-- Vadim Lobanov
Quoted 11 lines
It seems that the ultimate cause for all this strangeness was a mis-wired board: the vendor at long last admitted that the VBUS signal is not connected in the hardware. Why they didn't simply document this fact, and thereby save me a lot of wasted effort, remains a mystery.
As a workaround, they suggested setting bit
0x00000010in the ctl register, which is strangely enough inside the "reserved" space according to the AMD data book. Worth a shot, I thought. After hacking up the amd5536udc driver even more to do this operation at load time, the register states change to:cap=0x000083EA
mux=0x00000007
ctl=0x00000193Seems that a few other "reserved" bits also raised in response. (I still do not understand exactly how they wired up the CS5536 IO chip to be different from the data book, but oh well.) In this mode, the USB link is finally detected, and the board is finally able to enumerate itself as a
g_zerodevice.
This reserved bit seems to be an alias to the earlier mentioned PUEN bit which allows to connect the pull up manually regardless of VBUS. You will find that bit at page 276 in
http://www.amd.com/files/connectivitysolutions/aufamily/au1200/32798e_Au1200_ds.pdf
If you compare the registers you will find that UDC controller of Au1200 is 99.9% compatible with UDC of CS5536. Same for CS5536 UOC and Au1200 OTG Controller. But OTG Controller of Au1200 has more functionality and bits.
Unfortunately this bit is not the complete solution for your problem. When setting PUE then connect and disconnect events cannot be detected by UDC. If you disconnect and connect again you probably will notice that there will be no new enumeration as expected.
Quoted 2 lines
Please accept my sincere thank-you for your help. I'm hoping that everything will work from now on, and that I won't send any more questions your way. :)
My pleasure! It is fun for me to continue this thread.
Quoted 2 lines
I'll also await an update to the irq stuff in the amd5536udc driver that we talked about earlier, if you get around to making the fix for it first.
I will do when I have a new CS5536 board. Thanks for your analysis again!
Thomas
Quoted 33 lines · On Thursday 15 January 2009 01:26:04 Thomas Dahlmann wrote:
Quoted 15 lines
It seems that the ultimate cause for all this strangeness was a mis-wired
board: the vendor at long last admitted that the VBUS signal is not connected in the hardware. Why they didn't simply document this fact, and thereby save me a lot of wasted effort, remains a mystery.As a workaround, they suggested setting bit
0x00000010in the ctl register, which is strangely enough inside the "reserved" space according to the AMD data book. Worth a shot, I thought. After hacking up the amd5536udc driver even more to do this operation at load time, the register states change to:cap=0x000083EA
mux=0x00000007
ctl=0x00000193Quoted 5 lines
Seems that a few other "reserved" bits also raised in response. (I still do not understand exactly how they wired up the CS5536 IO chip to be different from the data book, but oh well.) In this mode, the USB link is finally detected, and the board is finally able to enumerate itself as a
g_zerodevice.This reserved bit seems to be an alias to the earlier mentioned PUEN bit which allows to connect the pull up manually regardless of VBUS. You will find that bit at page 276 in
http://www.amd.com/files/connectivitysolutions/aufamily/au1200/32798e_Au120
0_ds.pdfIf you compare the registers you will find that UDC controller of Au1200 is 99.9% compatible with UDC of CS5536. Same for CS5536 UOC and Au1200 OTG Controller. But OTG Controller of Au1200 has more functionality and bits.
Quoted 5 lines
Unfortunately this bit is not the complete solution for your problem. When setting PUE then connect and disconnect events cannot be detected by UDC. If you disconnect and connect again you probably will notice that there will be no new enumeration as expected.
Interestingly enough, when running in this configuration, unplugging and replugging the cable does cause a re-enumeration. Hmmmm.
-- Vadim Lobanov
Quoted 11 lines
Quoted 6 lines
Unfortunately this bit is not the complete solution for your problem. When setting PUE then connect and disconnect events cannot be detected by UDC. If you disconnect and connect again you probably will notice that there will be no new enumeration as expected.
Interestingly enough, when running in this configuration, unplugging and replugging the cable does cause a re-enumeration. Hmmmm.
-- Vadim Lobanov
Ah, I see. So PUE would be OK so far. I assume this worked as host recognizes a disconnect/connect and performs a USB reset. USB reset has almost the same effect as disconnect/connect on device side.
Thomas