summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/g_dnl.c
Commit message (Collapse)AuthorAgeLines
* usb: gadget Move: CONFIG_G_DNL_* to KconfigSam Protsenko2016-04-20-1/+1
| | | | | | And also reformat defconfigs using "make savedefconfig" rule. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
* USB: g_dnl: Change device classJohn Tobias2016-04-20-2/+2
| | | | | | | | | | | | | | | | | | | | | | | The USB Mass Storage (ums) works in Windows, Linux and OS X (EL Capitan). But, not in OS X (Yosemite). By applying the said patch, it extends the ums support. Signed-off-by: John Tobias <john.tobias.ph@gmail.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Test HW: Odroid XU3 (./test/py UMS + DFU tests) Tested-by: John Tobias <john.tobias.ph@gmail.com> Linux: - Run ums to expose all my eMMC partition - shows all correctly - Run ums to expose only 1 partition of my eMMC - show correctly Windows: - Run ums to expose all my eMMC partition - it detects but it prompts, if I want to format it (due to a non windows partition) - Run ums to expose only the FAT32 partition - it show the partition correctly.
* usb: gadget: don't leak configs when unbindingStephen Warren2015-09-11-2/+0
| | | | | | | | | | | | | | | | By the time g_dnl_unbind() is run, cdev->config has been set to NULL, so the free() there does nothing, and the config struct is leaked. Equally, struct usb_gadget contains a linked list of config structs, so the code should iterate over them all and free each one, rather than freeing one particular config struct. composite_unbind() already iterates over the list of config structs, and unlinks each from the linked list. Fix this loop to free() each struct as it's unlinked and otherwise forgotten. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com>
* usb: gadget: Weak board_usb_init/cleanup definitions in USB download gadget codePaul Kocialkowski2015-07-22-0/+13
| | | | | | | | | | | | Weak versions of board_usb_init and board_usb_cleanup are defined in common USB host code, but it is also used for USB device gadgets, so we also need a weak definition of it when there is no USB host enabled. Both weak definitions do not conflict. Signed-off-by: Paul Kocialkowski <contact@paulk.fr> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Test HW: Odroid_XU3 (Exynos5422), trats (Exynos4210)
* usb, g_dnl: generalize DFU detach functionsRob Herring2014-12-18-0/+17
| | | | | | | | | In order to add detach functions for fastboot, make the DFU detach related functions common so they can be shared. Signed-off-by: Rob Herring <robh@kernel.org> Tested-by: Lukasz Majewski <l.majewski@samsung.com> [TestHW: Exynos4412-Trats2]
* USB: gadget: save driver name before registering itStephen Warren2014-05-05-1/+2
| | | | | | | | | | | | | | | g_dnl_register() currently first attempts to register a composite driver by name, and then saves the driver name once it's registered. Internally to the registration code, g_dnl_do_config() is called and attempts to compare the composite device's name with the list of known device names. This fails since the composite device's name has not yet been stored. This means that the first time "ums 0 0" is run, it fails, but subsequent attempts succeed. Re-order the name-saving and registration code to solve this. Fixes: e5b834e07f51 ("USB: gadget: added a saner gadget downloader registration API") Signed-off-by: Stephen Warren <swarren@nvidia.com>
* USB: gadget: added a saner gadget downloader registration APIMateusz Zalega2014-05-05-36/+28
| | | | | | | | | | Preprocessor definitions and hardcoded implementation selection in g_dnl core were replaced by a linker list made of (usb_function_name, bind_callback) pairs. Signed-off-by: Mateusz Zalega <m.zalega@samsung.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Acked-by: Marek Vasut <marex@denx.de>
* usb: dfu: fix boards wo USB cable detectionMateusz Zalega2014-05-05-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | Former usb_cable_connected() patch broke compilation of boards which do not support this feature. I've renamed usb_cable_connected() to g_dnl_usb_cable_connected() and added its default implementation to gadget downloader driver code. There's only one driver of this kind and it's unlikely there'll be another, so there's no point in keeping it in /common. Previously this function was declared in usb.h. I've moved it, since it's more appropriate to keep it in g_dnl.h - usb.h seems to be intended for USB host implementation. Existing code, confronted with default -EOPNOTSUPP return value, continues as if the cable was connected. CONFIG_USB_CABLE_CHECK was removed. Change-Id: Ib9198621adee2811b391c64512f14646cefd0369 Signed-off-by: Mateusz Zalega <m.zalega@samsung.com> Acked-by: Marek Vasut <marex@denx.de> Acked-by: Lukasz Majewski <l.majewski@samsung.com>
* usb, g_dnl: make bcdDevice value configurableHeiko Schocher2013-11-12-4/+19
| | | | | | | | | | | add the possibility to set the bcdDevice number board specific. Therefore the weak function g_dnl_get_board_bcd_device_number() is introduced. Used on the siemens boards. Signed-off-by: Heiko Schocher <hs@denx.de> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Cc: Marek Vasut <marek.vasut@gmail.com> Cc: Kyungmin Park <kyungmin.park@samsung.com>
* usb, g_dnl: make iSerialNumber board configurableHeiko Schocher2013-11-08-0/+20
| | | | | | | | | | | | | | add the possibility to set the iSerialNumber board specific. Default value for iSerialNumber is 0x0. This value can changed board specific through the new function g_dnl_set_serialnumber() which must be called from the board specific function g_dnl_bind_fixup(). Signed-off-by: Heiko Schocher <hs@denx.de> Cc: Marek Vasut <marek.vasut@gmail.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com>
* usb:g_dnl: Support for TIZEN's THOR function in generic download codeLukasz Majewski2013-10-20-2/+8
| | | | | | | Support of "thor" function in generic download code (g_dnl.c). Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Cc: Marek Vasut <marex@denx.de>
* usb:g_dnl: Add name parameter to g_dnl_bind_fixup functionLukasz Majewski2013-10-20-2/+2
| | | | | | | | | New parameter, namely *name has been added to g_dnl_bind_fixup(). It is necessary (for compatibility reasons) to assign new USB idProduct and idVendor for different usb functions. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Cc: Marek Vasut <marex@denx.de>
* usb:g_dnl: Replace static usb_configuration structure with dynamically ↵Lukasz Majewski2013-10-20-8/+16
| | | | | | | | | | allocated one When the usb_configuration structure is declared as static, it is very hard to assure, that relevant fields (as e.g. config->interfaces[]) are cleared out before new call to g_dnl related functions. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
* usb:g_dnl:dfu: Download gadget and DFU function code clean upLukasz Majewski2013-09-24-1/+1
| | | | | | | | | | | | The download gadget code and DFU function lacks of proper declarations for the case when a target board wants to use only one of available usb functions. Moreover the relevant declarations have been moved to consistent localization (like <dfu.h>). Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Cc: Marek Vasut <marex@denx.de>
* usb:gadget:Remove redundant #includes for USB composite gadget and its functionsLukasz Majewski2013-09-24-1/+0
| | | | | | | | | | Only the <linux/usb/gadget.h> requires error.h include. Hence, several includes of error.h at USB gadget functions are not needed. Moreover unnecessary malloc.h includes were also removed. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Cc: Marek Vasut <marex@denx.de>
* usb:g_dnl:ums: Conditional compilation for mass storage function ↵Lukasz Majewski2013-09-24-1/+1
| | | | | | | | | | | | | | | (f_mass_storage) The mass storage composite function is now compiled in only when CONFIG_USB_GADGET_MASS_STORAGE is defined. Such change provides binary size reduction for boards which use USB download gadget (like am335x_evm) with DFU, but don't use UMS. For example at am335x_evm board reduction is more than 2KiB for text and around 120B for data. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Cc: Marek Vasut <marex@denx.de>
* usb:dfu:g_dnl: Refactoring the string definition code for g_dnl driverLukasz Majewski2013-08-26-4/+7
| | | | | | | | | | The manufacturer and product IDs are dynamically assigned when gadget is bind. Now the IDs aren't assigned at struct g_dnl_string_defs definition. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Cc: Marek Vasut <marex@denx.de> Cc: "Egli, Samuel" <samuel.egli@siemens.com>
* usb:dfu:g_dnl: Change number of exported configurations at composite gadgetLukasz Majewski2013-08-26-2/+4
| | | | | | | | | | | | | | | | | | | USB composite gadget (g_dnl) supports only one configuration. Due to that the corresponding field - bConfigurationValue has been changed. Moreover more descriptive names were chosen for relevant fields. Windows XP setup: - Thesyscon USB Descriptor Dumper - zadig_xp program for WinUSB installation (which is required by dfu-util) - dfu-util for windows (version 0.6) - TRATS target connected via USB hub to test Win XP machine. Tested at: Trats - Exynos4210 Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Cc: Marek Vasut <marex@denx.de> Cc: "Egli, Samuel" <samuel.egli@siemens.com>
* Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk2013-07-24-13/+1
| | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
* usb, g_dnl: make possibility to fixup the device_desc board specificHeiko Schocher2013-06-30-0/+7
| | | | | | | | | | | | add a weak dummy function g_dnl_fixup to add the possibility to update the device_desc board specific. Used on the upcoming siemens board support, where idVendor and idProduct is stored in an eeprom. Signed-off-by: Heiko Schocher <hs@denx.de> Cc: Marek Vasut <marek.vasut@gmail.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
* usb:gadget: USB Mass Storage Gadget supportLukasz Majewski2013-03-18-0/+6
| | | | | | | | | | | | | | This patch adds the USB Mass Storage Gadget to u-boot New command called "ums" is implemented to provide access to on-device embedded persistent memory. USB Mass Storage is supposed to work on top of the USB Gadget framework Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> CC: Marek Vasut <marek.vasut@gmail.com>
* g_dnl: Properly terminate string list.Pantelis Antoniou2012-12-17-0/+1
| | | | | | | Well, not terminating the list causes very interesting crashes. As in changing the vendor & product ID crashes. Fun. Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
* g_dnl: Issue connect/disconnect as appropriatePantelis Antoniou2012-12-17-1/+10
| | | | | | Call usb_gadget_connect/usb_gadget_disconnect in g_dnl_bind/g_dnl_unbind. Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
* dfu:usb: Support for g_dnl composite download gadget.Lukasz Majewski2012-09-01-0/+202
Composite USB download gadget support (g_dnl) for download functions. This code works on top of composite gadget. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Cc: Marek Vasut <marex@denx.de>