Commit graph

3168 commits

Author SHA1 Message Date
Sudip Mukherjee
0e7734193a usb: gadget: amd5536udc: remove forward declaration of udc_pci_*
Remove the forward declarations of udc_pci_probe and udc_pci_remove.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-10-01 12:40:22 -05:00
Sudip Mukherjee
3719b9bd66 usb: gadget: amd5536udc: remove forward declaration of udc_free_dma_chain
Rearrange udc_free_dma_chain to remove the forward declaration. While at
it fixed all the relevant checkpatch warnings.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-10-01 12:40:22 -05:00
Sudip Mukherjee
c9760ad817 usb: gadget: amd5536udc: remove forward declaration of udc_create_dma_chain
Rearrange udc_create_dma_chain to remove the forward declaration. While
rearranging fixed the relevant checkpatch warnings.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-10-01 12:40:21 -05:00
Sudip Mukherjee
79a5b4aa35 usb: gadget: amd5536udc: remove forward declaration of udc_remote_wakeup
Rearrange the udc_remote_wakeup function to remove the forward
declaration.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-10-01 12:40:21 -05:00
Sudip Mukherjee
4f06b6bb73 usb: gadget: amd5536udc: remove forward declaration of udc_probe
Rearrange the udc_probe function to remove the forward declarations.
While rearranging also fixed the relevant checkpatch warnings.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-10-01 12:40:21 -05:00
Sudip Mukherjee
76c3727da1 usb: gadget: amd5536udc: remove unnecessary conditions
The condition checking for irq_registered, regs, mem_region and active
are not required as this is the remove function. And we are in the
remove means that probe was successful and they can never be NULL at
this point of code.
It was required in the original code as the remove function was part of
the error handler of probe function.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-10-01 12:40:20 -05:00
Sudip Mukherjee
f349dd3c76 usb: gadget: amd5536udc: use free_dma_pools
We have the function free_dma_pools() which frees all the dma pools. Use
it instead of calling all the functions separately. The if conditions
for data_requests and stp_requests are also not required here as this is
the remove function and we are here means probe has succeeded and dma
has been successfully allocated, so they cannot be NULL here.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-10-01 12:40:20 -05:00
Sudip Mukherjee
2e1b7d0c69 usb: gadget: amd5536udc: use WARN_ON
Use WARN_ON() instead of halting the kernel with BUG_ON() and also fix
the checkpatch warning.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-10-01 12:40:20 -05:00
Sudip Mukherjee
580693bb3b usb: gadget: amd5536udc: fix error path
Handle the error properly instead of calling the pci remove function.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-10-01 12:40:20 -05:00
Sudip Mukherjee
14a37ec6c1 usb: gadget: amd5536udc: rewrite init_dma_pools
A rewrite of init_dma_pools() with proper error handling.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-10-01 12:40:19 -05:00
Junghak Sung
2d7007153f [media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.

Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
        <snip>
        unsigned int            bytesused;
        unsigned int            length;
        union {
                unsigned int    offset;
                unsigned long   userptr;
                int             fd;
        } m;
        unsigned int            data_offset;
}

Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
        <snip>
        unsigned int            index;
        unsigned int            type;
        unsigned int            memory;
        unsigned int            num_planes;
        struct vb2_plane        planes[VIDEO_MAX_PLANES];
        <snip>
};

v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
        struct vb2_buffer       vb2_buf;

        __u32                   flags;
        __u32                   field;
        struct timeval          timestamp;
        struct v4l2_timecode    timecode;
        __u32                   sequence;
};

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 09:04:43 -03:00
Junghak Sung
c139990e84 [media] media: videobuf2: Replace videobuf2-core with videobuf2-v4l2
Make videobuf2-v4l2 as a wrapper of videobuf2-core for v4l2-use.
And replace videobuf2-core.h with videobuf2-v4l2.h.
This renaming change should be accompanied by the modifications
of all device drivers that include videobuf2-core.h.
It can be done with just running this shell script.

replace()
{
str1=$1
str2=$2
dir=$3
for file in $(find $dir -name *.h -o -name *.c -o -name Makefile)
do
    echo $file
    sed "s/$str1/$str2/g" $file > $file.out
    mv $file.out $file
done
}

replace "videobuf2-core" "videobuf2-v4l2" "include/media/"
replace "videobuf2-core" "videobuf2-v4l2" "drivers/media/"
replace "videobuf2-core" "videobuf2-v4l2" "drivers/usb/gadget/"
replace "videobuf2-core" "videobuf2-v4l2" "drivers/staging/media/"

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:48:18 -03:00
Sudip Mukherjee
7022cfdfe0 usb: gadget: bdc: fix memory leak
If dma_pool_alloc() fails we are jumping to fail and releasing all the
bd_tables which have been added to the chain but we missed freeing this
bd_table which was just allocated and still not added to the chain of
bd_table.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-30 11:20:21 -05:00
Felipe Balbi
9903b6bedd usb: gadget: pch-udc: fix lock
gadget methods should be called without
spinlocks held.

Reported-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-28 11:24:29 -05:00
Robert Baldyga
5cd22f80bc usb: gadget: legacy: tcm: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of tcm, ep->driver_data was used only for endpoint claiming so
we can simplify code by reducing it. We also remove give_back_ep()
function which is not needed after all - when error code is returned
from bind() function, composite will release all endpoints anyway.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
4ce86bfaa6 usb: gadget: legacy: dbgp: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of dbgp, ep->driver_data was used only for endpoint claiming
and marking endpoints as enabled, so we can simplify code by reducing
it.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
18411c0f94 usb: gadget: u_serial: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of u_serial ep->driver_data stores pointer to struct gs_port,
which is referenced in many places in code. Code using ep->driver_data
to mark endpoint as enabled/disabled has been removed.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
6e4bfc5408 usb: gadget: u_ether: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of u_ether we only need to store in ep->driver_data pointer to
struct eth_dev, as it's used in rx_complete() and tx_complete() callbacks.
All other uses of ep->driver_data are now meaningless and can be safely
removed.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
d62bf8c165 usb: gadget: f_uvc: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of f_uvc, ep->driver_data was used only for endpoint claiming
and marking endpoints as enabled, so we can simplify code by reducing
it.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
887d8206c5 usb: gadget: f_uac2: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of f_uac2, ep->driver_data was used only for endpoint claiming
and marking endpoints as enabled, so we can simplify code by reducing
it.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
6ae6e1a241 usb: gadget: f_uac1: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of f_uac1, ep->driver_data was used only for endpoint claiming
and marking endpoints as enabled, so we can simplify code by reducing
it.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
bb38c18adb usb: gadget: f_subset: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of f_subset, ep->driver_data was used only for endpoint claiming
and marking endpoints as enabled, so we can simplify code by reducing
it.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
dbd2badfa6 usb: gadget: f_sourcesink: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of f_sourcesink we only need to store in ep->driver_data pointer
to struct f_sourcesink, as it's used in source_sink_complete() callback.
All other uses of ep->driver_data are now meaningless and can be safely
removed.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
885d22eb84 usb: gadget: f_serial: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of f_serial, ep->driver_data was used only for endpoint claiming
and marking endpoints as enabled, so we can simplify code by reducing
it.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
bbc474f788 usb: gadget: f_rndis: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of f_rndis, ep->driver_data was used only for endpoint claiming
and marking endpoints as enabled, so we can simplify code by reducing
it.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
ce21a98942 usb: gadget: f_printer: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of f_printer we only need to store in ep->driver_data pointer to
struct printer_dev, as it's used in rx_complete() and tx_complete()
callbacks. All other uses of ep->driver_data are now meaningless and can
be safely removed.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
101382ffb3 usb: gadget: f_phonet: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of f_phonet we only need to store in ep->driver_data pointer to
struct f_phonet, as it's used in pn_tx_complete() and pn_rx_complete()
callbacks. All other uses of ep->driver_data are now meaningless and can
be safely removed.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
d277e1a303 usb: gadget: f_obex: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of f_obex, ep->driver_data was used only for endpoint claiming
and marking endpoints as enabled, so we can simplify code by reducing
it.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
6b4012a2e4 usb: gadget: f_ncm: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of f_ncm, ep->driver_data was used only for endpoint claiming
and marking endpoints as enabled, so we can simplify code by reducing
it.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
ce723951a5 usb: gadget: f_midi: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of f_midi we only need to store in ep->driver_data pointer to
struct f_midi, as it's used in f_midi_complete() callback and related
functions. All other uses of ep->driver_data are now meaningless and
can be safely removed.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
1cecd54f32 usb: gadget: f_mass_storage: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of f_mass_storage we only need to store in ep->driver_data
pointer to struct fsg_common, which is used in bulk_in_complete() and
bulk_out_complete() callbacks. All other uses of ep->driver_data are now
meaningless and can be safely removed.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
0523ca4e48 usb: gadget: f_loopback: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of f_hid we only need to store in ep->driver_data pointer to
struct f_loopback, as it's used in loopback_complete() callback. All
other uses of ep->driver_data are now meaningless and can be safely
removed.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
2516a680c4 usb: gadget: f_hid: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of f_hid we only need to store in ep->driver_data pointer to
struct f_hidg, as it's used in f_hidg_req_complete() callback. All
other uses of ep->driver_data are now meaningless and can be safely
removed.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
34422a5e5a usb: gadget: f_eem: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of f_ecm, ep->driver_data was used only for endpoint claiming
and marking endpoints as enabled, so we can simplify code by reducing
it.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
4aab757ca4 usb: gadget: f_acm: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of f_acm we only need to store in ep->driver_data pointer to
struct f_acm, as it's used in acm_complete_set_line_coding() callback.
All other uses of ep->driver_data are now meaningless and can be safely
removed.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
92fbfc3884 usb: gadget: f_ecm: eliminate abuse of ep->driver data
Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of f_ecm, ep->driver_data was used only for endpoint claiming
and marking endpoints as enabled, so we can simplify code by reducing
it.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
b67f628c84 usb: gadget: epautoconf: add usb_ep_autoconfig_release() function
This patch introduces usb_ep_autoconfig_release() function which allows
to release endpoint previously obtained from usb_ep_autoconfig() during
USB function bind.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
35bfde3687 usb: gadget: f_ncm: obtain cdev from function instead of driver_data
The 'driver_data' field in ep0 is never set to pointer to cdev, so we
have to obtain it from another source as in this context ep->driver_data
contains invalid data.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Robert Baldyga
f871cb9b2e usb: gadget: fix few outdated comments
Fix comments in code to make them up to date.

composite: claiming endpoint is now done by setting ep->claimed flag,
not ep->driver_data.

epautoconf: usb_ep_autoconfig() and usb_ep_autoconfig_ss() return
claimed endpoint with ep->claimed flag already set.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
WEN Pingbo
04c4d8d4d5 usb: gadget: dummy_hcd: replace timeval with timespec64
The millisecond of the last second will be normal if tv_sec is
overflowed. But for y2038 consistency and demonstration purpose,
and avoiding further risks, we need to remove 'timeval' in this
driver, to avoid similair problems.

Signed-off-by: Pingbo Wen <pingbo.wen@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Peter Chen
046839098c usb: gadget: f_sourcesink: format data pattern according to max packet size
Since the host and gadget can't agree with transfer length before
each transfer, but they agree with max packet size for each
endpoint, we use max packet size to format data pattern.

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Mike Looijmans
bba787a860 usb: gadget: ether: Allow jumbo frames
USB network adapters support Jumbo frames. The only thing blocking
that feature is the code in the gadget driver that disposes of
packets larger than 1518 bytes, and the limit on the ioctl to set
the mtu.

This patch relaxes these limits, and allows up to 15k frames sizes.
The 15k value was chosen because 16k does not work on all platforms,
and usingclose to 16k will result in allocating 5 or 8 4k pages to
store the skb, wasting pages at no measurable performance gain.

On a topic-miami board (Zynq-7000), iperf3 performance reports:
MTU= 1500, PC-to-gadget: 139 Mbps, Gadget-to-PC: 116 Mbps
MTU=15000, PC-to-gadget: 239 Mbps, Gadget-to-PC: 361 Mbps

On boards with slower CPUs the performance improvement will be
relatively much larger, e.g. an OMAP-L138 increased from 40 to
220 Mbps using a similar patch on an  2.6.37 kernel.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Alexandre Belloni
428163d703 usb: gadget: at91_udc: move at91_udc_data in at91_udc.h
struct at91_udc_data is now only used inside the driver, move it to its
include.

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Felipe F. Tonello
f35fe4beb0 usb: gadget: f_midi: check for error on usb_ep_queue
f_midi is not checking whether there is an error on usb_ep_queue
request, ignoring potential problems, such as memory leaks.

Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Felipe Balbi
2e6c72b61b usb: gadget: mass_storage: allow for deeper queue lengths
Instead of allowing a range of 2 to 4 requests,
let's allow the user choose up to 32 requests
as that will give us a better chance of keeping
controller busy.

We still maintain default of 2 so users shouldn't
be affected.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Julia Lawall
51b91b7e6c usb: gadget: drop null test before destroy functions
Remove unneeded NULL test.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression x; @@
-if (x != NULL)
  \(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-21 14:42:36 -05:00
Igor Kotrasinski
9a9ce1dfae usb: gadget: dummy_hcd: in transfer(), return data sent, not limit
dummy_timer uses transfer() to update transfer limit. However,
limit passed to dummy_timer changes depending on transfer type,
so the actual limit is overwritten.

This can cause unpredictably slow / fast bulk transfers when
coupled with control / interrupt transfers.

Fix by returning actual amount of data sent in transfer() and
substracting from total.

Signed-off-by: Igor Kotrasinski <i.kotrasinsk@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-21 14:42:36 -05:00
Igor Kotrasinski
e42bd6a54b usb: gadget: dummy_hcd: fix rescan logic for transfer
transfer() schedules a rescan for transfers larger than
maxpacket, which is wrong for transfers that are multiples
of maxpacket.

Rewrite to fix and clarify packet multiple / remainder
transfer logic.

Signed-off-by: Igor Kotrasinski <i.kotrasinsk@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-21 14:42:36 -05:00
Igor Kotrasinski
5dda5be9d5 usb: gadget: dummy_hcd: fix unneeded else-if condition
We already know at this point that to_host is false.

Signed-off-by: Igor Kotrasinski <i.kotrasinsk@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-21 14:42:35 -05:00
Igor Kotrasinski
21c3ee9386 usb: gadget: dummy_hcd: emulate sending zlp in packet logic
currently, when a zlp flag is set and an urb/usb_request
buffer is filled without a short packet, transfer() leaves
its status at -EINPROGRESS and does not rescan for short
packet.

In a scenario where ep.maxpacket bytes are copied,
URB_ZERO_PACKET is set, urb buffer is filled and usb_request
buffer is not, transfer() returns with an urb with
-EINPROGRESS status, which dummy_hcd treats as incomplete
transfer.

Check for zlp and rescan appropriately.

Signed-off-by: Igor Kotrasinski <i.kotrasinsk@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-21 14:42:35 -05:00
Sylvain Rochet
cf261fd1a4 usb: gadget: atmel_usba_udc: add ep capabilities support on device tree binding
The recently added endpoint capabilities flags verification breaks Atmel
USBA because the endpoint configuration was only added when the driver
is bound using the legacy pdata interface.

Convert endpoint configuration to new capabilities model when driver is
bound to a device tree as well.

Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
Fixes: 47bef38651 ("usb: gadget: atmel_usba_udc: add ep capabilities support")
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-21 14:42:35 -05:00
Alexey Khoroshilov
6527cc2776 usb: gadget: amd5536udc: fix error handling in udc_pci_probe()
If a failure happens early in udc_pci_probe(), error handling code
just kfree(dev) and returns. The patch adds proper resource
deallocations in udc_pci_probe() itself,
since udc_pci_remove() is not suitabe to be called so early
in initialization process.

By the way, iounmap(dev->regs) is replaced by iounmap(dev->virt_addr)
in udc_pci_remove() for clarity.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-14 10:14:51 -05:00
Robert Baldyga
e4c1b1ba7f usb: gadget: fix possible regression introduced with ep->claimed
This patch fixes possible regression introduced by
patch reworking endpoint claiming mechanism. It restores
setring ep->driver_data to NULL in usb_ep_autoconfig_reset(),
which was removed by patch commit cc476b42a3.

Fixes: cc476b42a3 ("usb: gadget: encapsulate endpoint
	claiming mechanism")
Reported-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-14 09:51:50 -05:00
Linus Torvalds
089b669506 Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial tree updates from Jiri Kosina:
 "The usual stuff from trivial tree for 4.3 (kerneldoc updates, printk()
  fixes, Documentation and MAINTAINERS updates)"

* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (28 commits)
  MAINTAINERS: update my e-mail address
  mod_devicetable: add space before */
  scsi: a100u2w: trivial typo in printk
  i2c: Fix typo in i2c-bfin-twi.c
  treewide: fix typos in comment blocks
  Doc: fix trivial typo in SubmittingPatches
  proportions: Spelling s/consitent/consistent/
  dm: Spelling s/consitent/consistent/
  aic7xxx: Fix typo in error message
  pcmcia: Fix typo in locking documentation
  scsi/arcmsr: Fix typos in error log
  drm/nouveau/gr: Fix typo in nv10.c
  [SCSI] Fix printk typos in drivers/scsi
  staging: comedi: Grammar s/Enable support a/Enable support for a/
  Btrfs: Spelling s/consitent/consistent/
  README: GTK+ is a acronym
  ASoC: omap: Fix typo in config option description
  mm: tlb.c: Fix error message
  ntfs: super.c: Fix error log
  fix typo in Documentation/SubmittingPatches
  ...
2015-09-01 18:46:42 -07:00
Alexandre Belloni
e3ec4fda07 usb: gadget: atmel: remove useless include
Definitions from linux/platform_data/atmel.h are not used, remove the
include.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 16:54:02 -07:00
Greg Kroah-Hartman
a3fbedf98f usb: patches for v4.3 merge window
New support for Allwinne SoC on the MUSB driver has been added to the list of
 glue layers. MUSB also got support for building all DMA engines in one binary;
 this will be great for distros.
 
 DWC3 now has no trace of dev_dbg()/dev_vdbg() usage. We will rely solely on
 tracing to debug DWC3. There was also a fix for memory corruption with EP0 when
 maxpacket size transfers are > 512 bytes.
 
 Robert's EP capabilities flags is making EP selection a lot simpler. UDCs are
 now required to set these flags up when adding endpoints to the framework.
 
 Other than these, we have the usual set of miscelaneous cleanups and minor
 fixes.
 
 Signed-off-by: Felipe Balbi <balbi@ti.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJVzKiVAAoJEIaOsuA1yqRETzgP/3zwJOLKB1rA7FAXMSSps58G
 07hpKQumq4fd2JZzWulssIvLiShMKFHn/sqa4BJM2AAYpd/Ct3hCzI+WAseNTD7H
 mfkdezeEBSeZcG8BnMV08wUAf1MdUM4Xit60uVGSJi+dTT1Y8O/3QcTkXvnXwraN
 gH8/M/bO3YLu2uD627x3egLuYYfHn2waZnvpbxdLREirOW/OyYoNA9SUqh1VyNu7
 VIwKNF/l2RCKjI39FbUUjNMzZ468Cd53r1dLYeUMgwWMvziE4+iFum2qz/Gy5fBQ
 GxtHNVNcvovHc9NraAGMZx4oJeoAnlE2FJm4345i9E9YmYyEJfFyBU9HucmwLnU4
 R4wrz0IelCLDamdxzAjNYdD2JLLMGaFKMUxpfvn7KSYnHILedHgDe9xfYmfMQr+B
 oqPl1KptDgOeiea9bl2Vfdfm+TsroKXQF/YUBTEPy71vdQwSyK0W+YX6Ag2yBErC
 Fq3DcuFlSbDg7BAKXJV19FWNUt046k5pnf8s4W4fgmTZvHJeLTz8zpIYgOhXbzxc
 esR0igPZMuckeYDlTYKaFLJ/sqFX5eUpo38rO++wVIpxsEjmR9r1XZr6fkqT25hU
 mOS7S05xOCqAA66ErxrMk/bHznRMwB99f+BR1uOGDajqlgyg+wq6A5ftNbZrnGEw
 rv2rC0/Mo8rC136aV3UW
 =WuIB
 -----END PGP SIGNATURE-----

Merge tag 'usb-for-v4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

Felipe writes:

usb: patches for v4.3 merge window

New support for Allwinne SoC on the MUSB driver has been added to the list of
glue layers. MUSB also got support for building all DMA engines in one binary;
this will be great for distros.

DWC3 now has no trace of dev_dbg()/dev_vdbg() usage. We will rely solely on
tracing to debug DWC3. There was also a fix for memory corruption with EP0 when
maxpacket size transfers are > 512 bytes.

Robert's EP capabilities flags is making EP selection a lot simpler. UDCs are
now required to set these flags up when adding endpoints to the framework.

Other than these, we have the usual set of miscelaneous cleanups and minor
fixes.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-14 16:41:11 -07:00
Masahiro Yamada
e1c05067c3 treewide: fix typos in comment blocks
Looks like the word "contiguous" is often mistyped.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2015-08-07 14:46:24 +02:00
Diego Viola
1066c48281 drivers/usb/gadget/composite.c: i18n is not an acronym
Signed-off-by: Diego Viola <diego.viola@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2015-08-07 14:03:23 +02:00
Felipe Balbi
2e8328fb87 usb: gadget: legacy: nokia: add CONFIG_BLOCK dependency
g_nokia now has mass_storage function, so it should
depend on CONFIG_BLOCK.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-06 11:29:19 -05:00
Felipe Balbi
4a1e921180 usb: gadget: f_mass_storage: add mising <linux/uaccess.h>
<linux/uaccess.h> was originally being pulled
indirectly through some other header, however
it's not anymore, so we need to include it
directly

Reported-by: Jim Davis <jim.epost@gmail.com>
Suggested-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-06 11:23:32 -05:00
Robert Baldyga
adab43396e usb: gadget: remove gadget_chips.h
This header file contains helpers for quirks based on UDC controller name.
Since we have generic quirk bitfields in usb_gadget structure for all of
these quirks we don't need to have this header any longer.

This patch removes gadget_chips.h file and makes sure that it's no longer
included anywhere in kernel sources.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-06 09:35:20 -05:00
Robert Baldyga
26b8aa458c usb: musb: gadget: add musb_match_ep() function
Add 'match_ep' callback to utilize chip-specific knowledge in endpoint matching
process. Function does the same that was done by chip-specific code inside
of epautoconf. Now this code can be removed from there to separate generic code
from platform specific logic.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-06 09:35:11 -05:00
Robert Baldyga
8cc67b7bff usb: gadget: goku_udc: add goku_match_ep() function
Add 'match_ep' callback to utilize chip-specific knowledge in endpoint matching
process. Function does the same that was done by chip-specific code inside
of epautoconf. Now this code can be removed from there to separate generic code
from platform specific logic.

[ balbi@ti.com : fix build breakage ]

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-06 09:34:46 -05:00
Robert Baldyga
3e8b231818 usb: gadget: net2280: add net2280_match_ep() function
Add 'match_ep' callback to utilize chip-specific knowledge in endpoint matching
process. Function does the same that was done by chip-specific code inside
of epautoconf. Now this code can be removed from there to separate generic code
from platform specific logic.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-06 09:33:38 -05:00
Robert Baldyga
b0aea0037c usb: gadget: move find_ep() from epautoconf to udc-core
Move find_ep() to udc-core and rename it to gadget_find_ep_by_name().
It can be used in UDC drivers, especially in 'match_ep' callback after
moving chip-specific endpoint matching logic from epautoconf to UDC
drivers.

Replace all calls of find_ep() function with gadget_find_ep_by_name().

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-06 09:33:14 -05:00
Robert Baldyga
4278c687f6 usb: gadget: move ep_matches() from epautoconf to udc-core
Move ep_matches() function to udc-core and rename it to
usb_gadget_ep_match_desc(). This function can be used by UDC drivers
in 'match_ep' callback to avoid writing lots of repetitive code.

Replace all calls of ep_matches() with usb_gadget_ep_match_desc().

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-06 09:32:57 -05:00
Robert Baldyga
596c154d62 usb: gadget: add 'ep_match' callback to usb_gadget_ops
Add callback that is called by epautoconf to allow UDC driver match the
best endpoint for specific descriptor. It's intended to supply mechanism
which allows to get rid of chip-specific endpoint matching code from
epautoconf.

If gadget has set 'ep_match' callback we prefer to call it first, and
if it fails to find matching endpoint, then we try to use default matching
algorithm.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-06 09:31:45 -05:00
Robert Baldyga
26bf956aa9 usb: gadget: epautoconf: rework ep_matches() function
Rework ep_matches() function to make it shorter and more readable.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-06 09:24:07 -05:00
Robert Baldyga
5dbe135a15 usb: gadget: epautoconf: remove ep and desc configuration from ep_matches()
As function ep_matches() is used to match endpoint with usb descriptor it's
highly unintuitive that it modifies endpoint and descriptor structures fields.
This patch moves code configuring ep and desc from ep_matches() to
usb_ep_autoconfig_ss(), so now function ep_matches() does nothing more than
its name suggests.

[ balbi@ti.com : fix build warning ]

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:27:44 -05:00
Robert Baldyga
b58713d53a usb: gadget: epautoconf: remove pxa quirk from ep_matches()
The same effect can be achieved by using capabilities flags, so now we can
get rid of handling of hardware specific limitations in generic code.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:27:15 -05:00
Robert Baldyga
b86f33a3a3 usb: gadget: epautoconf: add endpoint capabilities flags verification
Introduce endpoint matching mechanism basing on endpoint capabilities
flags. We check if endpoint supports transfer type and direction requested
in ep descriptor. Since we have this new endpoint matching mechanism
there is no need to have old code guessing endpoint capabilities basing
on its name, so we are getting rid of it. Remove also the obsolete comment.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:27:11 -05:00
Robert Baldyga
47bef38651 usb: gadget: atmel_usba_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:27:09 -05:00
Robert Baldyga
927d9f77fe usb: gadget: udc-xilinx: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:55 -05:00
Robert Baldyga
0648772d51 usb: gadget: s3c2410_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:54 -05:00
Robert Baldyga
bc1b9f300a usb: gadget: s3c-hsudc: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:53 -05:00
Robert Baldyga
0ec8026d7a usb: gadget: r8a66597-udc: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:53 -05:00
Robert Baldyga
a180e3da97 usb: gadget: pxa27x_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:52 -05:00
Robert Baldyga
36411b6b04 usb: gadget: pxa25x_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:52 -05:00
Robert Baldyga
85a4ed003b usb: gadget: pch_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:51 -05:00
Robert Baldyga
7d4ba80d3a usb: gadget: omap_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:50 -05:00
Robert Baldyga
c23c3c3c30 usb: gadget: net2280: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:49 -05:00
Robert Baldyga
f95aec51da usb: gadget: net2272: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:48 -05:00
Robert Baldyga
43710a8dba usb: gadget: mv_udc_core: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:47 -05:00
Robert Baldyga
c12a30629f usb: gadget: mv_u3d_core: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:47 -05:00
Robert Baldyga
8ddbf94fd5 usb: gadget: m66592-udc: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:46 -05:00
Robert Baldyga
4d75c8bd61 usb: gadget: lpc32xx_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:46 -05:00
Robert Baldyga
8922699259 usb: gadget: gr_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:45 -05:00
Robert Baldyga
b0bf5fbfbd usb: gadget: goku_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:44 -05:00
Robert Baldyga
455d11c935 usb: gadget: fusb300_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:44 -05:00
Robert Baldyga
60a28c6371 usb: gadget: fsl_udc_core: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:43 -05:00
Robert Baldyga
e8fc42f6a1 usb: gadget: fsl_qe_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:42 -05:00
Robert Baldyga
8d29237a43 usb: gadget: fotg210-udc: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:41 -05:00
Robert Baldyga
7a3b8e7098 usb: gadget: dummy-hcd: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:41 -05:00
Robert Baldyga
b079dd6156 usb: gadget: bdc: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:40 -05:00
Robert Baldyga
1b0ba52770 usb: gadget: bcm63xx_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:39 -05:00
Robert Baldyga
b9ed96d7d5 usb: gadget: at91_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:38 -05:00
Robert Baldyga
6f02ac5ac9 usb: gadget: amd5536udc: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:26:36 -05:00
Robert Baldyga
cc476b42a3 usb: gadget: encapsulate endpoint claiming mechanism
So far it was necessary for usb functions to set ep->driver_data in
endpoint obtained from autoconfig to non-null value, to indicate that
endpoint is claimed by function (in autoconfig it was checked if endpoint
has set this field to non-null value, and if it has, it was assumed that
it is claimed). It could cause bugs because if some function doesn't
set this field autoconfig could return the same endpoint more than one
time.

To help to avoid such bugs this patch adds claimed flag to struct usb_ep,
and  encapsulates endpoint claiming mechanism inside usb_ep_autoconfig_ss()
and usb_ep_autoconfig_reset(), so now usb functions don't need to perform
any additional actions to mark endpoint obtained from autoconfig as claimed.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:24:05 -05:00
Felipe Balbi
0f4315a8f1 usb: gadget: f_uac2: fix build warning
commit 913e4a90b6 ("usb: gadget: f_uac2:
finalize wMaxPacketSize according to bandwidth")
added a possible build warning when calling
min(). In order to fix the warning, we just
make sure to call min_t() and tell that its
arguments should be u16.

Cc: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 11:02:45 -05:00
Alan Stern
c93e64e912 usb: udc: core: add device_del() call to error pathway
This patch fixes a bug in the error pathway of
usb_add_gadget_udc_release() in udc-core.c.  If the udc registration
fails, the gadget registration is not fully undone; there's a
put_device(&gadget->dev) call but no device_del().

CC: <stable@vger.kernel.org>
Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-03 09:54:18 -05:00