summaryrefslogtreecommitdiffstats
path: root/drivers/usb
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/warnings'Sascha Hauer2019-04-091-1/+1
|\
| * treewide: Make locally used functions staticSascha Hauer2019-03-181-1/+1
| | | | | | | | | | | | | | Many functions are only used locally but still are globally visible. Make these function static. Avoids warnings generated with -Wmissing-prototypes Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/usb-storage'Sascha Hauer2019-04-096-352/+265
|\ \
| * | usb: storage: Inline usb_limit_blk_cnt()Andrey Smirnov2019-03-111-11/+7
| | | | | | | | | | | | | | | | | | | | | Usb_limit_blk_cnt() has only one user so we may as well inline it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Drop unnecessary assignmentAndrey Smirnov2019-03-111-3/+1
| | | | | | | | | | | | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Simplify I/O loop in usb_stor_blk_io()Andrey Smirnov2019-03-111-13/+7
| | | | | | | | | | | | | | | | | | | | | | | | Simplify I/O loop a bit, by re-arranging things and dropping "sectors_done", "result" and "data" local variables. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Use simple boolean to speficy read vs. write operationAndrey Smirnov2019-03-111-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | Use simple boolean to speficy read vs. write operation usb_stor_blk_io() instead of having a custom anonymous enum. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Drop needless macroAndrey Smirnov2019-03-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | There's only user of the to_usb_mass_storage() so we may as well inline it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Drop unnecessary check in usb_stor_blk_io()Andrey Smirnov2019-03-111-27/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Checking that sector_count is zero, shouldn't be necessary since block layer won't call this function if there's no data to be read. Drop it. Checking that blockbits is eqal to SECTOR_SHIFT isn't necessary, since that field is filled by the driver and is not changed outsied of it. We know it is going to be SECTOR_SHIFT. Drop it. Checking sector_start > (ulong)-1 doesn't make sense at all since sector start is 'int' and it can't possibly be greater that ULONG_MAX. Drop it. Checking for sector_start >= pblk_dev->blk.num_blocks isn't necessary either, since we shouldn't receive request for invalid read from block layer. Drop it. Ditto for sector_count > INT_MAX and sector_start + sector_count > pblk_dev->blk.num_blocks. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: Drop usb_disable_asynch()Andrey Smirnov2019-03-112-33/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are no users of usb_control_msg() in the codebase that pass timeout of 0, so it doesn't look like usb_disable_asynch() has any effect on USB operation. Drop that function and remove all of its uses to simplify things. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Use put_unaligned_be* helpersAndrey Smirnov2019-03-111-11/+7
| | | | | | | | | | | | | | | | | | | | | Replace explicit endianness casts with put_unaligned_be* helpers. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Introduce usb_stor_transport()Andrey Smirnov2019-03-111-96/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | Move retry logic found in all of the low-level usb_stor_* functions into a standalone subroutine and convert the rest of the code to use it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Drop unused us_blkdev_listAndrey Smirnov2019-03-111-3/+0
| | | | | | | | | | | | | | | | | | | | | There are no users of us_blkdev_list in the file. Drop it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Drop unused fields in struct us_dataAndrey Smirnov2019-03-112-16/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only bulk-only transport is supported by the currennt codebase, so ep_bInterval and recv_intr_ep are not really used. Remove them and all related code. While at it remove flags and subclass as well since they are not really used anywhere in the codebase. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: hub: Do not include <scsi.h>Andrey Smirnov2019-03-111-1/+0
| | | | | | | | | | | | | | | | | | | | | No symbols found in <scsi.h> are used in this file. Drop it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Drop struct SCSI_cmd_blockAndrey Smirnov2019-03-114-75/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All the info we need to pass to transport function can be captured in a struct us_blk_dev and two byte arrays, so having a dedicated struct with many unused fields doesn't really buy us anything. Drop the struct and convert the rest of the code to pass needed data explicitly. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Remove unused variablesAndrey Smirnov2019-03-111-8/+0
| | | | | | | | | | | | | | | | | | | | | Drop a number of variables no longer used in the code. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Make usb_stor_request_sense() a standalone functionAndrey Smirnov2019-03-111-15/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | Don't try to re-use caller's "ccb" and instead convert usb_stor_request_sense() to use its own for clarity and to allow futher code improvements. No functional change intended. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Share code for READ(10) and WRITE(10)Andrey Smirnov2019-03-111-51/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | Both usb_stor_read_10() and usb_stor_write_10() do almost exactly the same thing, so merge them into a signle routine and adjust all of the users accordingly. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Drop extra call to transport in usb_stor_write_10()Andrey Smirnov2019-03-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | There doesn't seem to be a particularly good reason to call ->trasport() one last time after 2 failures. Drop the call so allow sharing this code with usb_stor_read_10() in the following commit. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Make usb_stor_write_10() a standalone functionAndrey Smirnov2019-03-111-18/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | Move special preparation steps done before the call to usb_stor_write_10() inside the function itself for clarity and to allow futher code improvements. No functional change intended. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Make usb_stor_read_10() a standalone functionAndrey Smirnov2019-03-111-16/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | Move special preparation steps done before the call to usb_stor_read_10() inside the function itself for clarity and to allow futher code improvements. No functional change intended. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Make usb_stor_test_unit_ready() a standalone functionAndrey Smirnov2019-03-111-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | Move special preparation steps done before the call to usb_stor_test_unit_ready() inside the function itself for clarity and to allow futher code improvements. No functional change intended. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Make usb_stor_inquiry() a standalone functionAndrey Smirnov2019-03-111-22/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | Move special preparation steps done before and after call to usb_stor_inquiry() inside the function itself for clarity and to allow futher code improvements. No functional change intended. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Make usb_stor_read_capacity() a standalone functionAndrey Smirnov2019-03-111-22/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | Move special preparation steps done before and after call to usb_stor_read_capacity() inside the function itself for clarity and to allow futher code improvements. No functional change intended. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Don't use "unsigned long" for 32-bit valuesAndrey Smirnov2019-03-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unsignled long will expand to 64-bit unsigned integer on 64-bit CPUs. This will break current code using it to read out two 32-bit values returned by READ_CAPACITY. Fix the proble by using "u32" explicitly. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Replace custom debug tracing with dev_dbgAndrey Smirnov2019-03-113-90/+94
| | | | | | | | | | | | | | | | | | | | | | | | Replace custom debug tracing macros with a call to dev_dbg to simplify code and add device info into degug output. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: Simplify memory allocation in usb_stor_probe()Andrey Smirnov2019-03-111-4/+1
| |/ | | | | | | | | | | | | | | Replace explicit malloc() + OOM check and memset() with a single call to xzalloc(). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | treewide: surround Kconfig file paths with double quotesMasahiro Yamada2019-03-211-7/+6
| | | | | | | | | | | | | | | | | | Based on Linux commit 8636a1f9677db4f883f29a072f401303acfc2edd This will be needed when you sync Kconfig with Linux 5.0 or later. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: dwc3: Toggle GCTL.CORESOFTRESET as a first stepAndrey Smirnov2019-03-181-0/+21
|/ | | | | | | | | | | | | Toggle GCTL.CORESOFTRESET before trying to access any of the block's registers. Without this additional step, first read of DWC3_GHWPARAMS* that follows results in assertion of GSTS.CSRTIMEOUT and IP block stuck in a non-functional state. Note that all above has only been observerd on i.MX8MQ (ZII Zest board) for USB1 controller. USB2 doesn't seem to be affected by this. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/nvme'Sascha Hauer2019-03-071-6/+1
|\
| * drivers: Make use of device_pci_driver()Andrey Smirnov2019-02-181-6/+1
| | | | | | | | | | | | | | Replace all of the generic PCI boilerplate with device_pci_driver(). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/imx8-usb'Sascha Hauer2019-03-0714-228/+3861
|\ \
| * | usb: usb251xb: add usb data lane port swap featureAndrey Smirnov2019-02-221-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Port of Linux patch https://patchwork.kernel.org/patch/10766235/ The HW can swap the USB differential-pair (D+/D-) for each port separately. So the USB signals can be re-aligned with a misplaced USB connector on the PCB. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Reviewed-by: Richard Leitner <richard.leitner@skidata.com> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: Port Microchip USB251x USB hub driver from LinuxAndrey Smirnov2019-02-225-0/+695
| | | | | | | | | | | | | | | | | | | | | | | | Port Microchip USB251x USB hub driver from Linux. Needed by ZII's i.MX8MQ boards. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: Import DWC3 USB controller driver from LinuxAndrey Smirnov2019-02-229-0/+2783
| | | | | | | | | | | | | | | | | | | | | | | | | | | Import DWC3 USB controller driver from Linux. This is a bare minimum port of the code needed to support USB host functionality on i.MX8MQ. No other use-case is explicitly supported. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Make use of lo_hi_readq/writeq()Andrey Smirnov2019-02-221-10/+4
| | | | | | | | | | | | | | | | | | | | | | | | Make use of lo_hi_readq/writeq() to implement xhci_read/write_64() helpers, same as it is done in the Linux kernel. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Simplify route string building loopAndrey Smirnov2019-02-221-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | Simplify route string building loop by avoiding checking top_dev->parent->descriptor->bDeviceClass twice. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Initialize TRT flag for xHCI >= 1.0Andrey Smirnov2019-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Initialize TRT flag for xHCI >= 1.0, not just == 1.0. This is what Linux xHCI driver does. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Check usb_pipein(pipe) only once in xhci_submit_normal()Andrey Smirnov2019-02-221-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | Simplfy xhci_submit_normal()'s logic a bit by using helper variables and making sure that usb_pipein(pipe) is only called once. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Drop 'dma' field from struct xhci_hcdAndrey Smirnov2019-02-222-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | Drop 'dma' field from struct xhci_hcd since it is not really used anywhere. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Simplify TRB initialization codeAndrey Smirnov2019-02-221-50/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current TRB initialization code in xHCI driver is: a) Somewhat inconsistent in endianness correctness: LE is insured in some places whereas in some places it isn't b) Somewhat inconsistent in how DMA buffer address is being written: some places utilize xhci_write_64, whereas others just assing cmd_trb field directly c) A bit wasetful since in a number of codepaths where TRB is used it is memset to zero first only to have 80+% of its fields changed to something else right after. To fix all of the above introduce xhci_init_event_cmd_trb(), that will initialize all of the fileds to desired values only once as well as taking care of endianness. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Convert xhci_submit_control() to use dma_map_single()Andrey Smirnov2019-02-221-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Convert xhci_submit_control() to use dma_(un)map_single(). These functions both allow us to handle potential physical/virtual address differences as well as allowing to drop a number of typecasts. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Convert xhci_submit_normal() to use dma_map_single()Andrey Smirnov2019-02-221-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Convert xhci_submit_normal() to use dma_(un)map_single(). These functions both allow us to handle potential physical/virtual address differences as well as allowing to drop a number of typecasts. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Don't try to DMA sync if buffer is NULLAndrey Smirnov2019-02-221-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Driver's .submit_control() callback can and will be called with buffer set to NULL (and length set to 0), so we need to make sure that we don't try to DMA sync the buffer in that case. Add appropriate gurads to make sure that doesn't happen. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Always wait for "Response Data" completionAndrey Smirnov2019-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Xhci_submit_control() submits TRB_DATA with TRB_IOC flag regardless of the vlaue of req->requesttype, so we shouldn't gate waiting for the event that will result from it with "req->requesttype & USB_DIR_IN". Failing to do this will result in unstable USB performance and will eventually cause the controller to fail completely. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Add support for 64-byte context sizeAndrey Smirnov2019-02-222-81/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | xHCI spec allows for various context to be either 32 or 64 bytes in size, so we can't rely on struct definitions to correctly reflect data layout. Port varios context accessors from Linux kernel and convert the rest of the code to use them in order to be able to support both context sizes. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Drop pointless bitwise orAndrey Smirnov2019-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | On_hs_hub is a boolean, not a bitfiled, so usage of bitwise or is unnecessary. Replace it with a regular assignement operator. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Make sure to initialize xhci->rings_listAndrey Smirnov2019-02-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Make sure to initialize xhci->rings_list, otherwise any use of the driver will result in a crash. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Cast ~XHCI_IRQS to u32Andrey Smirnov2019-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | | Cast ~XHCI_IRQS to u32 to avoid getting a warning on 64-bit builds. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>