Age | Commit message (Collapse) | Author | Files | Lines |
|
"num" is a u16 so it can't go higher than 65535. kstrtou16() has a
range check built in so this is already handled.
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
The dwc2-pci driver requires the generic PHY. This fixes undefined
reference issues when it is not selected.
Reported-by: kbuild test robot <[email protected]>
Signed-off-by: John Youn <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Use %ps for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pf expects a function descriptor
(which is not what __builtin_return_address returns).
Reviewed-by: Fabio Estevam <[email protected]>
Signed-off-by: Scott Wood <[email protected]>
Cc: [email protected]
CC: Sergei Shtylyov <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
If device is configured to work only in HOST or DEVICE mode, there is
no point in initializing both subdrivers. This patch also fixes
resource leakage if host subdriver fails to initialize.
Acked-by: John Youn <[email protected]>
Signed-off-by: Marek Szyprowski <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
The pci driver now registers a platform driver, like in dwc3, and lets
its probe function do all the initialization. This allows it to
account for changes to the platform driver that were not added to the
pci driver. Also future changes to the probe function don't have to be
duplicated. This also has the effect of adding device and DRD mode to
the pci driver. Tested on the Synopsys HAPS PCIe platform.
Signed-off-by: John Youn <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
udc is then checked for NULL, if NULL, it is then dereferenced as
udc->dev, it is found using Coccinelle.
We simplify the code to fix this problem, and we delete some conditions
at if {} which will never be met.
Reported-by: Tapasweni Pathak <[email protected]>
Reported-by : Julia Lawall <[email protected]>
Signed-off-by: Peter Chen <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
connect AR9271(USB wifi) to AM335x, and send a flood ping from Mac OSX,
AR9271 is stopped.
on USB bus, the following occurs.
- OUT transaction is ACKed (NYET).
- IN transaction is ACKed (512bytes).
- PING-NAK transaction is continued for about 2 seconds (AR9271 timeout?).
In current imprementation, IN-transaction is not completed because it
checks the empty of TX-FIFO in cppi41_dma_callback().
As a result, communication to AR9271 stops.
This patch modified to check the empty of TX-FIFO only when OUT-transaction.
Signed-off-by: Takeyoshi Kikuchi <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Commit 9eb0797722895f4309b4 ("usb: phy: generic: fix the gpios to be optional")
calls gpiod_direction_output() in the probe function, so there is no need to
call it again, as we can simply call gpiod_set_value() directly.
Also, in usb_gen_phy_shutdown() we can simply put the GPIO directly in its
active level state and this allows us to simplify the nop_reset function to
treat only the reset case.
Signed-off-by: Fabio Estevam <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Function usb_ep_disable() causes completion of all requests queued
for given endpoint, so there is no need to dequeue them after endpoint
disabling.
Signed-off-by: Robert Baldyga <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Not everybody uses a utf8 locale (unfortunately), so let's avoid
non-ascii characters in the kernel log. Replace the 3-byte utf8
sequence with a 3-byte ascii equivalent.
Signed-off-by: Rasmus Villemoes <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
This patch add suspend/resume with wakeup support for Atmel USBA.
On suspend: We stay continuously clocked if Vbus signal is not
available. If Vbus signal is available we set the Vbus signal as a wake
up source then we stop the USBA itself and all clocks used by USBA.
On resume: We recover clocks and USBA if we stopped them. If a device is
currently connected at resume time we enable the controller.
Signed-off-by: Sylvain Rochet <[email protected]>
Acked-by: Boris Brezillon <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
If USB PLL is not necessary for other USB drivers (e.g. OHCI and EHCI)
we will reduce power consumption by switching off the USB PLL if no USB
Host is currently connected to this USB Device.
We are using Vbus GPIO signal to detect Host presence. If Vbus signal is
not available then the device stays continuously clocked.
Signed-off-by: Sylvain Rochet <[email protected]>
Acked-by: Nicolas Ferre <[email protected]>
Acked-by: Boris Brezillon <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Vbus IRQ handler needs a started UDC driver to work because it uses
udc->driver, which is set by the UDC start handler. The previous way
chosen was to return from interrupt if udc->driver is NULL using a
spinlock around the check.
We now request an auto disabled (IRQ_NOAUTOEN) Vbus signal IRQ instead
of an auto enabled IRQ followed by disable_irq(). This way we remove the
very small timeslot of enabled IRQ which existed previously between
request() and disable(). We don't need anymore to check if udc->driver
is NULL in IRQ handler.
Signed-off-by: Sylvain Rochet <[email protected]>
Suggested-by: Boris Brezillon <[email protected]>
Acked-by: Boris Brezillon <[email protected]>
Acked-by: Nicolas Ferre <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
If vbus gpio is high at init, we should set vbus_prev to true
accordingly to the current vbus state. Without that, we skip the first
vbus interrupt because the saved vbus state is not consistent.
Signed-off-by: Sylvain Rochet <[email protected]>
Acked-by: Nicolas Ferre <[email protected]>
Acked-by: Boris Brezillon <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Fixed a comment typo in drivers/usb/phy/of.c
Signed-off-by: Mickael Maison <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Fixed a comment typo in drivers/usb/phy/phy-ab8500-usb.c
Signed-off-by: Mickael Maison <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
replace numeric value with TYPE_NO_LUN (defined in <scsi/scsi.h>)
Signed-off-by: Tal Shorer <[email protected]>
Acked-by: Michal Nazarewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
This patch fix some spelling typo found in gadget.xml.
It is because this file is generated from comments in sources,
I had to fix comments in the source, instead of xml file itself.
Signed-off-by: Masanari Iida <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
If we pass our own of_node to musb_core, at least
pinctrl settings will be duplicated, meaning that
pinctrl framework will try to select default pin
state for musb_core when they were already requested
by musb-dsps.
A Warning will be printed however things will still
work.
Reported-by: Tony Lindgren <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
musb shouldn't have of_node and phy phandle is passed
to dsps device, not musb's.
Signed-off-by: Felipe Balbi <[email protected]>
|
|
This reverts commit ef11982dd7a657512c362242508bb4021e0d67b6.
That commit creates a problem for some UDCs (at least musb)
where it allocates an endpoints with a 64-byte FIFO, but later
tries to use that same FIFO for 1024-byte packets.
Before implementing this, composite framework needs to be
modified so we only allocate endpoints after we know negotiated
speed, however that needs quite a bit of extra work.
Cc: <[email protected]> # v3.18+
Signed-off-by: Felipe Balbi <[email protected]>
|
|
This reverts commit 27082e2654dc ("xhci: Clear the host side toggle manually")
Turns out this fix to enable soft resetting endpoints wasn't mature enough.
It caused regression with some usb DVB-T devices and needs some more tuning
to get the endpiont ring pointers set correctly.
The original commit was tagged for stable 3.18, and should be reverted
from there as well.
Cc: stable <[email protected]> # v3.18
Signed-off-by: Mathias Nyman <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
|
|
This fixes a potential null pointer dereference.
Cc: <[email protected]> # v3.16+
Fixes: d4332013919a ("driver core: dev_get_drvdata: Don't check for NULL dev")
Acked-by: Sebastian Andrzej Siewior <[email protected]>
Signed-off-by: David Dueck <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
When dwc2 controller detects a disconnect interrupt,
dwc2_hcd_disconnect() should be called immediately to do clean-up
jobs and set port_connect_status_change flag to notify usb hub
driver disconnect status.
Tested-by: Vincent Palatin <[email protected]>
Acked-by: John Youn <[email protected]>
Signed-off-by: Yunzhi Li <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Add support for configfs interface so that f_printer can be used as a
component of usb gadgets composed with it.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Substitute some boilerplate code with a dedicated macro.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
There are no old interface users left, so it can be removed.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
The goal is to remove the old function interface, so its (only) user
must be converted to the new interface.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
compatibility
In order to add configfs support, a usb function must be converted to use
the new interface. This patch converts the function to the new interface
and provides backward compatiblity layer, which can be removed after
all its users are converted to use the new interface.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
The legacy printer gadget now contains both a reusable printer function
and legacy gadget proper implementations interwoven, but logically
separate. This patch factors out a reusable f_printer.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
With all the obstacles removed it is possible to allow more than one
instance of the printer function. Since the function requires allocating
character device region, a maximum number of allowed instances is defined.
Such an approach is used in f_acm and in f_hid.
With multiple instances it does not make sense to depend on a
lock_printer_io member of a dynamically allocated (and destroyed) struct
printer_dev to clean up after all instances of the printer function.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Verify that a given usb_ctrlrequest is meant for printer function.
The following parts of the request are tested:
- bmRequestType:Data transfer direction
- bmRequestType:Type
- bmRequestType:Recipient
- bRequest
- wValue for bRequest 1 and 2
- wLength
Additionally, the request is considered meant for this function
iff the decoded interface number matches dev->interface.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Avoid using magic numbers.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Non-standard requests can encode the actual interface number in a
non-standard way. For example composite_setup() assumes
that it is w_index && 0xFF, but the printer function encodes the interface
number in a context-dependet way (either w_index or w_index >> 8).
This can lead to such requests being directed to wrong functions.
This patch adds req_match() method to usb_function. Its purpose is to
verify that a given request can be handled by a given function.
If any function within a configuration provides the method and it returns
true, then it is assumed that the right function is found.
If a function uses req_match(), it should try as hard as possible to
determine if the request is meant for it.
If no functions in a configuration provide req_match or none of them
returns true, then fall back to the usual approach.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
5 uses of container_of() in the same context justify wrapping it
in a static inline function.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
function's code
The printer_dev can be recovered from printer_func_unbind() function's
parameters.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
The mutex is a legacy after semi-automatic Big Kernel Lock removal.
printer_open() does its own locking, so no need to duplicate it.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Call gprinter_setup() from gadget's bind instead of module's init.
Call gprinter_cleaup() corerspondingly. This detaches printer function's
logic from legacy printer gadget's implementation.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Factor out gprinter_setup() and gprinter_cleanup() so that it is
easy to change the place they are called from.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
In order to factor out a reusable f_printer, the function's code should
not use file global variables related to legacy printer gadget's
implementation.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Avoid using magic numbers.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
In order to factor out a reusable f_printer.c, the code related to the
function should be placed in functions related to the function.
printer_cfg_unbind() becomes empty, so it is removed.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Conversion to the new function interface requires splitting a
<something>_bind_config() function into two parts: allocation of
container_of struct usb_function and invocation of usb_add_function().
This patch moves the latter to the end of the f_printer_bind_config()
in order to enable conversion to the new interface.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
In order to factor out a reusable f_printer.c, the code related to the
function should be placed in functions related to the function.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Follow the convention of distributing source code between
<something>_do_config() and <something>_bind_config().
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Legacy gadgets, before converting them to the new function framework,
used to use the name <something>_do_config() for usb_add_config()'s
callback.
This patch changes the name so that it is easier to follow
the convention.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
The pdev member of struct printer_dev is not used outside
printer_bind_config(), so it can just as well be a local variable there.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
If cdev_add() in printer_bind_config() fails, care is taken to
reverse the effects of initializations completed until the fail
happens. But if printer_req_alloc() fails, it is just one of the
two lists that is cleaned up while the effects of cdev_add()
and device_create() are not reverted.
This patch changes error handling so that at least as much cleanup is done
as when a failure happens before printer_req_alloc() invocations.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
Whenever the "goto fail" branch is taken, the effect of usb_add_function()
should be reverted.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|
|
struct printer_dev contains 3 list heads: tx_reqs, rx_reqs and rx_buffers.
There is just one instance of this structure in the driver and it is
file static, and as such initialized with all zeros.
If device_create() or cdev_add() fails then "goto fail" branch is taken,
which results in printer_cfg_unbind() call. The latter checks if
tx_reqs, rx_reqs and rx_buffers lists are empty. The check for emptiness
is in fact a check whether the "next" member of struct list_head points
to the head of the list. But the heads of the lists in question have
not been initialized yet and, as mentioned above, contain all zeros,
so list_empty() returns false and respective "while" loop body starts
executing. Here, container_of() just subtracts the offset of a struct
usb_request member from an address of this same member, which results in
a value somewhere near 0 or 0xfff...ff. And the argument to list_del()
dereferences such a pointer which causes a disaster.
This patch moves respective INIT_LIST_HEAD() invocations to a point before
"goto fail" branch can be taken.
Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
|