When compiling with OHCI_DEBUG enabled, gcc complains about a
lot of bad format strings. So let's use more appropriate format
modifiers to fix these warnings.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
When scanning hubs, the code in libusb can be called recursively, for
example usb_hub_init() calls setup_new_device(), which then calls
slof_usb_handle() to execute Forth code for the next device.
If that next device is a hub, we end up recursively in usb_hub_init()
again.
Since stack space is limited in SLOF, we can optimize here a little
bit by splitting up the setup_new_device() function into the part
that retrieves the descriptors (which takes most of the stack space
in this code path since the descriptors are placed on the stack),
and the part that populates the the device tree node of the new
device (which is responsible for the recursion).
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
While doing cleanup of the allocated memory, make sure addresses being
unmapped/free were really allocated. During error conditions, some
address would not have been.
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
usb-ohci.c: In function ‘ohci_process_done_head’:
usb-ohci.c:458:4: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘struct ohci_td *’ [-Wformat]
usb-ohci.c:417:20: warning: variable ‘start_frame’ set but not used [-Wunused-but-set-variable]
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
The routine had got complicated and source of few bugs while using in
pci-passthru and js2x
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Endpoint descriptors toggleCarry bit needs to be preserved when using
DataToggle bit in transfer descriptor is set to 0.
Also zero the bulk_curr_ed
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
* JS20 exposed various timing related issues that were not apparent in
the emulated environment.
* Reset the USB Bus
* JS20 overrides the frame_interval and periodic_start on setting the
controller to USB operational. Reprogram them.
* ohci fix the data-toggle bits.
* Robust error handling
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
OHCI HC after using the TDs queues them back to hccaDoneHead. Until
this event the TDs cannot be reused, as there might be references in
the host controller still pending. Recycle all the TDs from the queue
and acknowledge it by clearing the WD bit in interrupt status
register.
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
* Start the control/bulk processing after ed is written
* Clear the content of control_head_ed and bulk_head_ed
once done using them.
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Moreover ehci already suspends the controller in the hcd_exit path. So
we can remove hc-suspend from the cleanup path.
Also, count mechanism is not needed anymore, as quiesce is called only
once.
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Or it will continue DMA'ing which is not a good idea. On recent qemu's
that add proper DMA error handling, it will get into error state.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
We cannot just access MMIO like that. On KVM for example, this has
to be hypercalls. On js2x, we need to use special cache-inhibited
loads and stores.
We have accessors in cache.h, we just need to use them. However that
means that read/write_reg() are no longer suitable for in-memory
byteswaps. We need to use the accessors in byteorder.h for that
While at it, we also fix the code to use mb() instead of barrier()
as a full memory barrier is needed to actually order things.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Clean up all the dma allocated buffers and remove their mappings.
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Acked-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Support for usb generic hub driver.
Todo: Detect disconnects and remove device
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Acked-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Portions of keyboard driver(usb-key.h and usb-hid.c) inherited from
code originally written by former SLOF team
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Acked-by: Thomas Huth <thuth@linux.vnet.ibm.com>
* Configures the newly found usb devices.
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Fixes-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Acked-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Introduce generice usb_send_control and implement correspoding stubs
in ohci and ehci
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Acked-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Generic routines to get pipe structure from controller.
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Acked-by: Thomas Huth <thuth@linux.vnet.ibm.com>
usb-core: usb_pipe structure, this structure will be embedded in
controller specific pipe structure and accessed using
container_of macro.
usb-ohci: allocate pipe pool and support routines
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Acked-by: Thomas Huth <thuth@linux.vnet.ibm.com>