summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge branch 'for-next/misc'Sascha Hauer2017-09-081-4/+13
|\
| * usb: gadget: autostart: properly release f_multi_optsOleksij Rempel2017-09-061-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the same as for usb gadget autostarter. |commit 2b9bcff79a02f770fa730e2689ba35cc03c0da7d |Author: Sascha Hauer <s.hauer@pengutronix.de> |Date: Fri Jan 20 10:03:45 2017 +0100 | | usb: gadget: properly release f_multi_opts | | The usbgadget commands uses statically allocated f_multi_opts and passes | this to usb_multi_register(). These f_multi_opts are of course no | longer valid when we leave the usbgadget command. Luckily we do not use | the data after we left the usbgadget command, so this never has been a | problem. However, f_multi_opts has some allocated members which we can | not free anymore on gadget unregistration because we no longer have the | pointer to them. | | Fix this by adding a release function to struct f_multi_opts. This way | we can allocate all memory dynamically and properly free it when not | used anymore. | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | at91_udc: add DT supportSam Ravnborg2017-09-061-11/+45
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on the linux kernel version of the same driver. Needs to adjust clock names as the clock names used in the device tree does not match the clocknames used in platform_data. The clocknames in the device tree are not unique, so it was not an option to rename the clocks. It boots and the driver is discovered - no further testing done. $ devinfo fff78000.gadget Resources: num: 0 name: /ahb/apb/gadget@fff78000 start: 0xfff78000 size: 0x00004000 Driver: at91_udc Bus: platform Parameters: vbus: 1 (type: bool) Device node: /ahb/apb/gadget@fff78000 gadget@fff78000 { compatible = "atmel,at91sam9263-udc"; reg = <0xfff78000 0x4000>; interrupts = <0x18 0x4 0x2>; clocks = <0x26 0x27>; clock-names = "pclk", "hclk"; status = "okay"; atmel,vbus-gpio = <0x28 0x19 0x0>; }; Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/parameter-types'Sascha Hauer2017-05-051-2/+2
|\
| * param: make parameter functions more consistentSascha Hauer2017-04-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch creates a consitent set of device parameter functions. With this we have: dev_add_param_<type><access> "type" is one of: int32, uint32, int64, uint64, string, mac, ipv4, enum, bitmask The improvement here is that we now can exactly specify the width of the int type parameters and also correctly distinguish between signed and unsigned variables which means that a variable no longer ends up with INT_MAX when it's assigned -1. "access" can be empty for regular read/write parameter, "_ro" for readonly parameters which get their value from a variable pointer in the background or "_fixed" for parameters which are set to a fixed value (without a pointer in the background). Some more exotic types are not (yet) implemented, like dev_add_param_ip_ro. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: gadget: fastboot: delete temporary fileSascha Hauer2017-04-121-0/+3
|/ | | | | | | | After we have copied the data to its final destination there is no need to keep the temporary file around. Remove it when done with it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: gadget: set otg to peripheral mode on autostartOleksij Rempel2017-04-061-0/+3
| | | | | | | we won't be able to start if otg is not properly configured. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: gadget: start usbgadget automaticallyOleksij Rempel2017-03-313-0/+79
| | | | | | | ... if global variable configured to do it. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/usb'Sascha Hauer2017-03-131-2/+21
|\
| * usb: gadget: properly release f_multi_optsSascha Hauer2017-03-091-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The usbgadget commands uses statically allocated f_multi_opts and passes this to usb_multi_register(). These f_multi_opts are of course no longer valid when we leave the usbgadget command. Luckily we do not use the data after we left the usbgadget command, so this never has been a problem. However, f_multi_opts has some allocated members which we can not free anymore on gadget unregistration because we no longer have the pointer to them. Fix this by adding a release function to struct f_multi_opts. This way we can allocate all memory dynamically and properly free it when not used anymore. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: gadget: print a meaningful error messageSascha Hauer2017-03-091-0/+5
| | | | | | | | | | | | | | We can only register one USB multi gadget, so check for it being already registered and print a meaningful error message if it is. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fastboot: abort autoboot timeout when fastboot gadget is activatedMarc Kleine-Budde2017-03-101-0/+3
| | | | | | | | | | | | | | | | | | This patch adds a call to "console_countdown_abort()" to abort a currently or upcoming running console timeout. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: gadget: fastboot: close fd after downloadSascha Hauer2017-02-231-0/+1
|/ | | | | | The fd for the downloaded file is never closed. Fix this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: gadget: disable AT91 driver on SAMA5D4Lucas Stach2017-01-171-0/+1
| | | | | | | | | | | This architecture is missing the right defines for the system peripherals, that are needed for this driver to build successfully. Disable it for now until someone with a clue about this architecture can fill in the gap. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: Move bulk of boot.h to bootm.hSascha Hauer2016-07-261-1/+1
| | | | | | | | The majority of the stuff currently in include/boot.h is about bootm code implemented common/bootm.c. To be more consistent move it to a new file include/bootm.h. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* USB: gadget: composite: avoid possible NULL ptr dereferenceLucas Stach2016-07-071-1/+3
| | | | | | | Check if g is valid before trying to dereference it. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: fastboot: Fix oem exec supportSascha Hauer2016-05-101-1/+1
| | | | | | | | | Fixes: b1374a6 usb: fastboot: drop CONFIG_COMMAND_SUPPORT dependency The correct config option to depend on is CONFIG_COMMAND_SUPPORT, not CONFIG_COMMAND. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ubiformat'Sascha Hauer2016-05-092-7/+16
|\
| * usb: fastboot: drop CONFIG_COMMAND_SUPPORT dependencySascha Hauer2016-04-262-1/+5
| | | | | | | | | | | | | | fastboot can run without command support. In this case we cannot execute oem commands. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: fastboot: Use C API for ubiformatSascha Hauer2016-04-261-5/+11
| | | | | | | | | | | | | | | | This makes it possible to compile the fastboot gadget without command support. While at it bail out when ubiformat is not compiled in. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/include-cleanup'Sascha Hauer2016-05-092-4/+6
|\ \ | |/ |/|
| * string: Fix (v)asprintf prototypesSascha Hauer2016-04-152-4/+5
| | | | | | | | | | | | | | | | | | | | Our asprintf and vasprintf have different prototypes than the glibc functions. This causes trouble when we want to share barebox code with userspace code. Change the prototypes for (v)asprintf to match the glibc prototypes. Since the current (v)asprintf are convenient to use change the existing functions to b(v)asprintf. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * include: move run_command prototype to command.hSascha Hauer2016-04-151-0/+1
| | | | | | | | | | | | run_command fits much better into command.h, move it there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fix erasing/protecting flashes with unspecified sizeSascha Hauer2016-04-192-3/+3
|/ | | | | | | | | | | | | | | | | fixes: 81737c1 mtd: Fix erasing of devices >4GiB Several places erased a complete flash partition passing ~0 as count to erase(). With the above commit count to erase was changed from an unsigned type to a signed type, so the (count > f->size - offset) check in erase() no longer triggers and the ~0 count is no longer adjusted to the whole device size. Among other things this results in saveenv failures on NOR flashes. This patch fixes this by introducing an explicit macro for erasing the whole device which is tested for in erase(). All other negative values are rejected. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reported-by: Giorgio <giorgio.nicole@arcor.de>
* Merge branch 'for-next/driver'Sascha Hauer2016-03-112-4/+10
|\
| * driver: replace dev_request_mem_region with dev_request_mem_resourceSascha Hauer2016-03-072-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dev_request_mem_region doesn't work properly one some SoCs on which PTR_ERR() values clash with valid return values from dev_request_mem_region. Replace them with dev_request_mem_resource where possible. This patch has been generated with the following semantic patch: // <smpl> @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { ... - return PTR_ERR(io); -} + return PTR_ERR(iores); +} +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) - return PTR_ERR(io); -} + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { - ret = PTR_ERR(io); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { + ret = PTR_ERR(iores); ... } +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ identifier func; @@ func(...) { <+... struct resource *iores; -struct resource *iores; ...+> } // </smpl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * driver: Fix return check of dev_request_mem_regionSascha Hauer2016-02-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dev_request_mem_region returns an ERR_PTR, fix places which check for a NULL pointer instead. This patch has been generated with this semantic patch, written by me and improved by Andrey Smirnov: // <smpl> @@ expression e; expression e1; @@ e = dev_request_mem_region(...); ... -if (!e) - return e1; +if (IS_ERR(e)) + return PTR_ERR(e); @ rule1 @ expression e; @@ e = dev_request_mem_region(...); @@ expression rule1.e; identifier ret, label; constant errno; @@ if (!e) { ... ( - ret = -errno; + ret = PTR_ERR(e); ... goto label; | - return -errno; + return PTR_ERR(e); ) } @depends on rule1@ expression rule1.e; @@ - if (e == NULL) + if (IS_ERR(e)) { ... } // </smpl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
* | fastboot: Add a ARM Barebox filetype handlerMarkus Pargmann2016-03-111-0/+31
| | | | | | | | | | | | | | | | | | This will automatically call barebox_update for the transfered file if it is an ARM Barebox image and the destination file is defined by some update handler. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fastboot: Fix usage of ubiformat for UBI image transfersMarkus Pargmann2016-02-181-1/+16
|/ | | | | | | | | | | | | | Currently all fastboot flash commands with UBI images are handled by a final call to 'ubiformat'. This only makes sense for flash commands where the target file is a mtd device. If we just want to transfer a UBI image we would expect a simple copy to the correct location. This patch checks if the destination file is a MTD device by opening it and calling an ioctl MEMGETINFO. Only for MTD devices, ubiformat is called. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Introduce include/linux/spinlock.hYegor Yefremov2016-02-011-0/+1
| | | | | | | Move spinlock related definitions to its original place. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: chipidea: Add udc unregister for device removalMarkus Pargmann2015-09-231-0/+13
| | | | | | | | | | | | The host may assume that the usb device is still up and running after booting if we do not deregister the udc here. I observed issues when the linux kernel was using a usb gadget directly where the complete USB Hub got disconnected through this. This patch adds a proper USB disconnect for gadget devices. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* restart: replace reset_cpu with registered restart handlersSascha Hauer2015-08-271-1/+2
| | | | | | | | | | | | | | | | | | | | | | This replaces the reset_cpu() function which every SoC or board must provide with registered handlers. This makes it possible to have multiple reset functions for boards which have multiple ways to reset the machine. Also boards which have no way at all to reset the machine no longer have to provide a dummy reset_cpu() function. The problem this solves is that some machines have external PMICs or similar to reset the system which have to be preferred over the internal SoC reset, because the PMIC can reset not only the SoC but also the external devices. To pick the right way to reset a machine each handler has a priority. The default priority is 100 and all currently existing restart handlers are registered with this priority. of_get_restart_priority() allows to retrieve the priority from the device tree which makes it possible for boards to give certain restart handlers a higher priority in order to use this one instead of the default one. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: gadget: serial: only call into CONSOLE_FULL code if it's thereLucas Stach2015-07-241-2/+3
| | | | | | | | | Fixes: drivers/built-in.o: In function `gserial_connect': drivers/usb/gadget/u_serial.c:539: undefined reference to `console_set_active' Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: gadget: pxa27x: depend on right symbolLucas Stach2015-06-261-1/+1
| | | | | | | | Now that we also have PXA3XX support the dependency on ARCH_PXA is too broad for this driver. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: gadget: serial: Use console_set_active to activate consoleSascha Hauer2015-06-091-1/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: gadget: fsl_udc: convert to streaming DMA opsLucas Stach2015-03-061-4/+4
| | | | | | | | | Move to the common streaming DMA ops in order to get rid of the direct usage of the ARM MMU functions for the cache maintenance. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: move DMA alloc functions to dma.hLucas Stach2015-03-061-0/+3
| | | | | | | | | | This better separates the DMA from the MMU functionality. Also move all drivers that only depends on asm/mmu.h for the alloc functions over to the common header. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: change dma_alloc/free_coherent to match other architecturesLucas Stach2015-03-061-3/+4
| | | | | | | | | As a lot drivers currently rely on the 1:1 virt->phys mapping on ARM we define DMA_ADDRESS_BROKEN to mark them. In order to use them on other architectures with a different mapping they need proper fixing. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2015-02-041-0/+1
|\
| * console: allow to specify the device idJean-Christophe PLAGNIOL-VILLARD2015-01-131-0/+1
| | | | | | | | | | | | | | so we can use dynamic number id with specific devname Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: at91_udc: pass the vbus initial valueBo Shen2015-02-041-0/+2
|/ | | | | | | | If without pass the vbus initial value, the vbus status alway present as 0 even if the vbus is connected to 5v. Signed-off-by: Bo Shen <voice.shen@atmel.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: gadget: fastboot: allow to build without BOOTMLucas Stach2014-12-171-1/+4
| | | | | | | | | | | This will disable the capability to boot an uploaded image directly, but keeps other fastboot functionality. This seems like a valid config. Fixes: In function `do_bootm_on_complete': undefined reference to `bootm_boot' Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* USB: Gadget: fastboot: depends on command supportSascha Hauer2014-11-271-0/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* USB: Gadget: Select poller from USB_GADGET optionSascha Hauer2014-11-271-3/+1
| | | | | | | The poller has been merged to the gadget core, so now the core needs poller support, not the individual drivers. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: gadget: fastboot: select BANNERLucas Stach2014-11-241-0/+1
| | | | | | | | Fastboot gadget needs the 'release_string' which is available only if CONFIG_BANNER is set. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* dfu: fix possible usage of uninitialized varLucas Stach2014-10-211-0/+1
| | | | | | | | The error path would in fact use the status variable without it being initialized first. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/resource-err-ptr'Sascha Hauer2014-10-022-2/+6
|\
| * resource: Let dev_request_mem_region return an error pointerSascha Hauer2014-09-162-2/+6
| | | | | | | | | | | | For all users fix or add the error check. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | USB: gadget: allow multiple udc driversSascha Hauer2014-09-261-9/+3
| | | | | | | | | | | | | | | | | | | | Since the MUSB driver will have it's own directory the Kconfig entries won't be in drivers/usb/gadget/Kconfig. This is incompatible with the current 'choice' approach for udc drivers. The udc drivers do not implement the global usb_gadget_poll() anymore, so we can drop the choice and allow multiple gadget drivers. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | USB: gadget: put poller into coreSascha Hauer2014-09-264-74/+54
| | | | | | | | | | | | | | | | Instead of letting each driver implement usb_gadget_poll directly implement this function in the core which then calls into the drivers. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>