summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/ether.c
Commit message (Collapse)AuthorAgeFilesLines
* usb: gadget: ether: return error from rx_submit if no requestTroy Kisky2013-10-201-0/+2
| | | | | | | | | | | | | | | | | | | | This prevents a crash if tftpboot is given a bad filename. rx_req will be released by eth_reset_config which is called by eth_disconnect, which is called using the .disconnect member of usb_gadget_driver by mv_pullup in mv_udc which is called using the .pullup member of usb_gadget_ops by usb_gadget_disconnect which is called by usb_eth_halt which is called using the .halt member of eth_device by eth_halt which is called by TftpHandler when TFTP_ERR_FILE_NOT_FOUND or TFTP_ERR_ACCESS_DENIED occurs I trigger this with the following commands setenv ipaddr 10.0.0.2 && setenv netmask 255.255.255.0 && setenv serverip 10.0.0.1 setenv usbnet_devaddr 00:11:22:33:44:55 && setenv usbnet_hostaddr 00:aa:bb:cc:dd:ee setenv ethprime usb_ether && setenv ethact usb_ether && setenv ncip 10.0.0.1 tftpboot 10800000 10.0.0.1:missing_file Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
* usb: gadget: ether set wMaxPacketSizeTroy Kisky2013-10-201-0/+2
| | | | | | | | | | | | | | | | | | | | | set wMaxPacketSize for full speed descriptors fs_source_desc, fs_sink_desc to 64. Full-speed bulk endpoint can have a maximum packet size of 8, 16, 32, or 64 bytes, so choice 64. The hs_source_desc, hs_sink_desc, already have their wMaxPacketSize set to 512. That is the only legal value for high speed bulk endpoints. Strictly speaking, this patch is not needed because usb_ep_autoconfig will call ep_matches which will override wMaxPacketSize for BULK endpoints only with the size associated with the endpoint setup by the udc driver. But if you want to rely on this, you may as well combine the full speed descriptor with the high speed descriptor to minimize confusion. Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
* usb: gadget: Fix data aborts during USB ethernet bootJoel Fernandes2013-09-241-2/+3
| | | | | | | | | | | | | | As seen on GCC 4.6 Linaro compiler, control_req buffer is not aligned on 4 byte boundaray causing data aborts in eth_setup -> conf_buf during dhcp boot over usb_ether. Fix the issue my aligning control_req buffer using DEFINE_CACHE_ALIGN_BUFFER. Tested on am335x_evm platform (beaglebone). Applies on 2013.10-rc1 branch. Cc: Tom Rini <trini@ti.com> Cc: Marek Vasut <marex@denx.de> Signed-off-by: Joel Fernandes <joelf@ti.com>
* Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk2013-07-241-13/+1
| | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
* linux/usb/ch9.h: update with the version from Linux treeIlya Yanok2012-11-201-1/+0
| | | | Signed-off-by: Ilya Yanok <ilya.yanok@cogentembedded.com>
* usb gadget ether: Fix warning in is_eth_addr_valid()Tom Rini2012-11-041-2/+2
| | | | | | | | | | | | | | The gadget ethernet driver needs to keep copies of the MAC address (at both endpoints) as strings so it needs a custom function for validation of the MAC. It was not however performing a totally correct check and also was emitting a warning about a set but unused variable. The solution to both is that after checking the string contents we use the standard test for a valid MAC. Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Marek Vasut <marex@denx.de> Signed-off-by: Tom Rini <trini@ti.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* usbether: Removed DEV_CONFIG_{CDC,SUBSET}Lukasz Dalek2012-10-151-45/+30
| | | | | | | Removed DEV_CONFIG_CDC and DEV_CONFIG_SUBSET and replaced it with CONFIG_USB_ETH_CDC and CONFIG_USB_ETH_SUBSET. Signed-off-by: Lukasz Dalek <luk0104@gmail.com>
* usbether: Define CONFIG_USB_ETH_{CDC,SUBSET}Lukasz Dalek2012-10-151-5/+14
| | | | | | | Introduced CONFIG_USB_ETH_CDC and CONFIG_USB_ETH_SUBSET as preparation for removal DEV_CONFIG_CDC and DEV_CONFIG_SUBSET Signed-off-by: Lukasz Dalek <luk0104@gmail.com>
* usbether: Fixed bug when using with PXA25X chipsLukasz Dalek2012-10-151-1/+16
| | | | | | | | | | PXA25X chips don't support alternate settings so driver uses non-CDC driver. But only code defined between DEV_CONFIG_CDC signals that network is up. This patch is fixing this bug by signaling that network is up after USB SET_INTERFACE request. Signed-off-by: Lukasz Dalek <luk0104@gmail.com>
* net: Fix remaining API interface breakageJoe Hershberger2012-05-231-4/+3
| | | | | | | | | | | These are all the files which use the API incorrectly but did not get built using MAKEALL -a powerpc|arm. I have no compiler for them, but the remaining issues should be far less than without this patch. Any outstanding issues are left to the maintainers of boards that use these drivers. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* usb:udc: Remove duplicated USB definitions from include/linux/usb/ch9.h fileLukasz Majewski2012-05-201-0/+1
| | | | | | | | | | | Remove the repeated USB descriptor code and use usbdescriptors.h file. ch9.h file has been copied from linux and is needed for USB gadget related work. Now usbdescriptors.h and ch9.h shall be used together. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Cc: Marek Vasut <marex@denx.de>
* USB-RNDIS: Send RNDIS state on disconnectingVitaly Kuzmichev2011-02-191-0/+23
| | | | | | | Add waiting for receiving Ethernet gadget state on the Windows host side before dropping pullup, but keep it for debug. Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
* USB: Add USB RNDIS gadget protocolVitaly Kuzmichev2011-02-191-60/+580
| | | | | | | Port USB gadget RNDIS protocol support from linux-2.6.26 (.27 gadget stack actually has composite drivers). Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
* USB-CDC: Move struct declaration before its useVitaly Kuzmichev2011-02-191-34/+36
| | | | Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
* USB-CDC: Port struct net_device_statsVitaly Kuzmichev2011-02-191-0/+39
| | | | | | | Port struct net_device_stats and statistics collecting needed for RNDIS protocol. Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
* USB-CDC: handle interrupt after dropped pullupVitaly Kuzmichev2011-02-191-0/+7
| | | | | | | | | | | | Disconnecting USB gadget with pending interrupt may cause its wrong handling in the next time when interface will be started again (especially actual for RNDIS). This interrupt may force the gadget to queue unexpected response before setup stage. Despite the fact that such interrupt handled after dropped pullup also may add pending response, this will not bring to any issues due to usb_ep_disable (which clears the queue) called on gadget unregistering. Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
* USB-CDC: Move MAC addresses setting into usb_eth_initVitaly Kuzmichev2011-01-191-36/+26
| | | | | | | This allows to change device and host MAC addresses without performing reset. Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
* USB-CDC: Do not rename netdev after its registrationVitaly Kuzmichev2011-01-191-3/+2
| | | | | | | Calling eth_bind at usb_eth_init time causes renaming of the network device from 'usb_ether' to 'usb0'. Fixing this to keep the first name. Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
* usb_ether: register usb ethernet gadget at each eth initLei Wen2011-01-191-4/+8
| | | | | | | | | | | | Since the ether may not be the only one usb gadget would be used in the uboot, it is neccessary to do the register each time the eth begin to work to make usb gadget driver less confussed when we want to use two different usb gadget at the same time. Usb gadget driver could simple ignore the register operation, if it find the driver has been registered already. Signed-off-by: Lei Wen <leiwen@marvell.com>
* Coding Style cleanupWolfgang Denk2010-10-271-1/+0
| | | | Signed-off-by: Wolfgang Denk <wd@denx.de>
* USB-CDC: Prevent rx_req being enqueued twiceVitaly Kuzmichev2010-10-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After gadget reinitializaton (after tftp has been done once) packet_received may become equal to 1 due to nuking OUT_EP while disabling it in eth_reset_config. rx_submit called from usb_eth_init queues rx_req first time. But the first call of usb_eth_recv from NetLoop queues rx_req again due to packet_received = 1. The following flow shows the path of functions calls when this happens: net/net.c:NetLoop | +-net/eth.c:eth_init | ether.c:usb_eth_init | | | +-udc_driver:usb_gadget_handle_interrupts | | udc_driver:... | | ether.c:eth_setup | | ether.c:eth_set_config | | ether.c:eth_reset_config | | udc_driver:usb_ep_disable | | udc_driver:nuke | | ether.c:rx_complete | | ether.c: packet_received = 1; | | | +-ether.c:rx_submit | udc_driver:usb_ep_queue --- The first time when rx_req is queued | +-net/eth.c:eth_rx ether.c:usb_eth_recv | +-udc_driver:usb_gadget_handle_interrupts | udc_driver:... --- no interrupts, returning +-ether.c: if (packet_received) { ... ether.c:rx_submit udc_driver:usb_ep_queue --- The second time! Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
* USB-CDC: Fix tx/rx_req memory leaksVitaly Kuzmichev2010-10-131-13/+7
| | | | | | | | | | | | Remove and fix needless and destructive operations with tx/rx_req. 1) 'req' in rx_complete is always not NULL and always equals to rx_req 2) Free allocated tx_req if rx_req allocation has failed 3) Do not zero out tx/rx_req in usb_eth_init, leave this for eth_reset_config which will be called at the next use of usb0 4) Additional check in usb_eth_recv is not required Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
* USB-CDC: Fix coding style issuesVitaly Kuzmichev2010-09-201-246/+267
| | | | | | | | | | | | | | | | | Fixes most of checkpatch warnings and errors in USB gadget stack. The most frequently encountered problems are: 1) "(foo*)", "foo * bar", "foo* bar" 2) C99 // comments 3) No spaces before/after/around '?', ':', '=', '==', ',', '&', '(' 4) Spaces before '[' 5) Spaces between function names and '(' 6) Block braces in wrong places 7) Spaces before tabs 8) Macros with complex values not enclosed in parenthesis 9) Multiline comments start just after /* Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
* USB-CDC: called handle_interrupts inside usb_eth_sendStefano Babic2010-09-201-1/+9
| | | | | | | | | The patch removes an endless loop in the usb_eth_send if the tx_complete is not called before going in the loop. The driver interrupt routine is called allowing the driver to check if the TX is completed. Signed-off-by: Stefano Babic <sbabic@denx.de>
* USB-CDC: correct wrong alignment in ether.cStefano Babic2010-09-201-1/+1
| | | | | | | | The buffer for the status request must be word aligned because it is accessed with 32 bit pointer in the eth_status_complete function. Signed-off-by: Stefano Babic <sbabic@denx.de>
* USB-CDC: ethernet error path potential oops fixVitaly Kuzmichev2010-09-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix potential oops on rare error path. The patch is based on commit e7b13ec9235b9fded90f826ceeb8c34548631351 (done by David Brownell <david-b@pacbell.net>) from linux-2.6.git. Description of the issue taken from linux kernel bugzilla: (https://bugzilla.kernel.org/show_bug.cgi?id=9594) The potential error can be tracked down as follows: (1) line 807: let the second conjunct on the "if" statment be false meaning "dev->status_ep" is null. This means the "if" evaluates to false. follow thru the code until... (2) line 808: usb_ep_disable(dev->status_ep) passes in a null argument, however "usb_ep_disable" cannot handle that: (from include/linux/usb/gadget.h) 191 static inline int 192 usb_ep_disable (struct usb_ep *ep) 193 { 194 return ep->ops->disable (ep); 195 } -- Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
* USB-CDC: Correct stat_req initializationVitaly Kuzmichev2010-09-201-4/+3
| | | | | | | | Fix possible oops on stat_req->buf initialization and fix ep0 and status_ep confusion (last one is just intended for stat_req keeping). Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com> Signed-off-by: Stefano Babic <sbabic@denx.de>
* USB-CDC: Replace 'strcpy' by 'strlcpy'Vitaly Kuzmichev2010-09-201-3/+3
| | | | | | Replace 'strcpy' by more safe 'strlcpy' that is implemented in ether.c Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
* USB-CDC: Correct freeing usb requestsVitaly Kuzmichev2010-09-201-2/+7
| | | | | | | Fix in_ep and out_ep confusion (rx_req was allocated from out_ep, not from in_ep) and add lost dev->req freeing. Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
* USB-CDC: Use native debug printout macrosVitaly Kuzmichev2010-09-201-53/+43
| | | | | | | | Replace Linux-like debug printout macros by native ones. Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com> Applied after removing dead code like '#define DEBUG/#undef DEBUG'
* USB-CDC: Add lost 'qmult' definitionVitaly Kuzmichev2010-09-201-0/+6
| | | | | | | Add lost 'qmult' definition for High Speed devices and make it configurable through CONFIG_USB_ETH_QMULT. Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
* Integrate USB gadget layer and USB CDC driver layerRemy Bohmer2010-09-201-0/+1947
Derived from Linux kernel 2.6.27 Signed-off-by: Thomas Smits <ts.smits@gmail.com> Signed-off-by: Remy Bohmer <linux@bohmer.net>
OpenPOWER on IntegriCloud