Fix bugs introduced in
9c62ce83e4
usb: gadget: ether: convert to new interface of f_ecm
94b5573e97
usb: gadget: ether: convert to new interface of f_eem
8af5232d6f
usb: gadget: ether: convert to new interface of f_subset
9bd4a10e1b
usb: gadget: ether: convert to new interface of f_rndis
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
use new interface so old one can be removed.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Converting rndis to the new function interface requires converting
the USB rndis' function code and its users.
This patch converts the f_rndis.c to the new function interface.
The file is now compiled into a separate usb_f_rndis.ko module.
The old function interface is provided by means of a preprocessor
conditional directives. After all users are converted, the old interface
can be removed.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
teach ethernet code about the new interface of f_subset so
the old one can eventually be removed.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Converting ecm subset to the new function interface requires converting
the USB subset's function code and its users.
This patch converts the f_subset.c to the new function interface.
The file is now compiled into a separate usb_f_subset.ko module.
The old function interface is provided by means of a preprocessor
conditional directives. After all users are converted, the old interface
can be removed.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
use new interface so old one can be removed.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Converting eem to the new function interface requires converting
the USB eem's function code and its users.
This patch converts the f_eem.c to the new function interface.
The file is now compiled into a separate usb_f_eem.ko module.
The old function interface is provided by means of a preprocessor
conditional directives. After all users are converted, the old interface
can be removed.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
moving to new interface so we can remove the older one.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Converting ecm to the new function interface requires converting
the USB ecm's function code and its users.
This patch converts the f_ecm.c to the new function interface.
The file is now compiled into a separate usb_f_ecm.ko module.
The old function interface is provided by means of a preprocessor
conditional directives. After all users are converted, the old interface
can be removed.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
In order to convert to configfs the usb functions need to be converted
to a new interface and compiled as modules. This patch creates an rndis
module which will be used by the new functions. After all users of
f_rndis are converted to the new interface, this module can be
merged with f_rndis module.
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
u_ether.c has been #include'd by all gadgets which implement
USB Ethernet functions. In order to add configfs support,
the f_ecm.c, f_eem.c, f_ncm.c, f_subset.c, f_rndis.c need to be
converted into modules and must not be #include'd. Consequently,
the u_ether.c needs to be a module too, in a manner similar
to u_serial.c. The resulting module should not take any parameters,
so they are pushed to the current users of it, that is ether.c,
g_ffs.c, multi.c, ncm.c, nokia.c.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
the u_ether.c file has a global variable named the_dev which keeps a
pointer to the network device after it has been created via
gether_setup_name(). It is only used internally by u_ether. This patches
moves the variable to its users and passes it via the port.ioport where
it is saved later anyway.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
The bcdDevice field is defined as
|Device release number in binary-coded decimal
in the USB 2.0 specification. We use this field to distinguish the UDCs
from each other. In theory this could be used on the host side to apply
certain quirks if the "special" UDC in combination with this gadget is
used. This hasn't been done as far as I am aware. In practice it would
be better to fix the UDC driver before shipping since a later release
might not need this quirk anymore.
There are some driver in tree (on the host side) which use the bcdDevice
field to figure out special workarounds for a given firmware revision.
This seems to make sense. Therefore this patch converts all gadgets
(except a few) to use the kernel version instead a random 2 or 3 plus
the UDC number. The few that don't report kernel's version are:
- webcam
This one reports always a version 0x10 so allow it to do so in future.
- nokia
This one reports always 0x211. The comment says that this gadget works
only if the UDC supports altsettings so I added a check for this.
- serial
This one reports 0x2400 + UDC number. Since the gadget version is 2.4
this could make sense. Therefore bcdDevice is 0x2400 here.
I also remove various gadget_is_<name> macros which are unused. The
remaining few macros should be moved to feature / bug bitfield.
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
This moves composite.c into libcomposite and updates all gadgets.
Finally!
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Some gadgets provide custom entry here. Some may override it with an
etntry that is also created by composite if there was no value sumbitted
at all.
This patch removes all "custom manufacturer" strings which are the same
as these which are created by composite. Then it moves the creation of
the default manufacturer string to usb_composite_overwrite_options() in
case no command line argument has been used and the entry is still an
empty string.
By doing this we get rid of the global variable "composite_manufacturer"
in composite.
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
The index in usb_string array is defined by the gadget. The gadget can
choose which index entry it assigns for the serial number and which the
product name. The gadget has just to ensure that the descriptor contains
the proper string id which is assigned by composite.
If the composite layer knows the index of the "default" information
which will be overwritten by module parameters, it can be used later to
overwrite it.
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
This patch moves the module options idVendor, idProduct and bcdDevice
from composite.c into each gadgets. This ensures compatibility with
current gadgets and removes the global variable which brings me step
closer towards composite.c in libcomposite
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Using usb_string_ids_tab() instead multiple calls of usb_string_id()
seems to be handy. It also allows to add string without many checks.
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
This patch adds epautoconf.c into libcomposite and updates all gadgets.
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
This patch moves config.c into libcomposite and updates all gadgets.
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
This patch aims to be simple. It removes #include usbstribgs.c line from each
gadget and creates libcomposite.ko which has only one member, that is
usbstribgs.c.
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
This partly reverts 07a18bd7 ("usb gadget: don't save bind callback in
struct usb_composite_driver") and fixes new drivers. The section missmatch
problems was solved by whitelisting structs in question via __ref.
Cc: devel@driverdev.osuosl.org
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
As it turns out, Sam's comment was better than I initially assumed. This
patch pushes as struct usb_composite_driver data structures into
__refdata section to avoid a section missmatch report from modpost
because the ->bind() can be marked __init. The only downside is that
modpost does not check between ->bind() and other member. However, it is
temporary.
Cc: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
module_param(bool) used to counter-intuitively take an int. In
fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy
trick.
It's time to remove the int/unsigned int option. For this version
it'll simply give a warning, but it'll break next kernel version.
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
remove the following two paragraphs as they are not needed:
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,59
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Signed-off-by: Klaus Schwarzkopf <schwarzkopf@sensortherm.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Add SuperSpeed descriptors to the Network USB
function drivers.
This has been lightly tested using a Linux host.
I was able to ssh from device to host and host to
device, no obvious problems seen.
Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
This field is used by the Gadget drivers to specify
the maximum speed they support, meaning: the maximum
speed they can provide descriptors for.
The driver speed will be set in consideration of this
value.
[ balbi@ti.com : dropped the ifdeffery ]
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
The bind function is most of the time only called at init time so there
is no need to save a pointer to it in the configuration structure.
This fixes many section mismatches reported by modpost.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
[m.nazarewicz@samsung.com: updated for -next]
Signed-off-by: Michał Nazarewicz <m.nazarewicz@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
The bind function is most of the time only called at init time so there
is no need to save a pointer to it in the composite driver structure.
This fixes many section mismatches reported by modpost.
Signed-off-by: Michał Nazarewicz <m.nazarewicz@samsung.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This reverts a commit which proposed an invalid solution
for a section mismatch. Next 3 commits will fix it correctly.
Conflicts:
drivers/usb/gadget/mass_storage.c
Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
In may gadgets bind and bind like functions were in a init section
as they were only run during initialisation. However, being
callback functions they were referenced from structures in “normal”
sections. Changing the tag from “__init” to “__ref” fixes the
warnings.
Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
If g_ether and g_multi are both built CONFIG_USB_ETH_RNDIS symbol
may be redefined in the later and, whats even worse, g_ether's settings
may affect g_multi's. This adds a USB_ETH_RNDIS symbol defined at the
beginning of ether.c and multi.c according toproper KConfig settings.
Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Remove expository comments and fix USB VID and PID
Signed-off-by: Brian Niebuhr <bniebuhr@efjohnson.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This patch adds a CDC EEM ethernet gadget driver. CDC EEM is a newer
USB ethernet specification that uses a simpler interface than the older
CDC ECM. This makes CDC EEM usable by a wider set of USB hardware.
By default the ethernet gadget will still use CDC ECM/Subset, but kernel
configuration and/or a module parameter will allow alternative use of
the CDC EEM protocol.
Changes since last version:
- Brought in missing RNDIS changes that caused compile error
- Modified 'sentinel CRC' checking to match EEM host driver
Signed-off-by: Brian Niebuhr <bniebuhr@efjohnson.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
The reworked Ethernet gadget has an RNDIS interop problem when used
with the CDC subset driver ... e.g. on PXA 2xx and 3xx hardware,
which currently has a hard time talking to MS-Windows hosts.
The issue is that Microsoft requires USB_CLASS_COMM. Fix by tweaking
the CDC subset driver to not switch to USB_CLASS_VENDOR_SPEC if RNDIS
is used in some other device configuration.
[ UPDATED: some "statements" were comma-terminated; fix that. ]
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Aric Blumer <aric@sdgsystems.net>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
The base versions handle constant folding now.
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Offer a "how much VBUS power to request" configuration option
for USB gadgets that aren't using board-specific customization
of their gadget or (composite) configuration drivers.
Also remove a couple pointless "depends on USB_GADGET" bits
from the Kconfig text; booleans inside an "if USB_GADGET" will
already have that dependency.
Based on a patch from Justin Clacherty.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Justin Clacherty <justin@redfish-group.com>
Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Change how the Ethernet/RNDIS gadget driver builds: don't
use separate compilation, since it works poorly when key
parts are library code (with init sections etc). Instead
be as close as we can to "gcc --combine ...".
This is a bit more complicated than most of the others
because it had to resolve a few symbol collisions.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
We want to use WARN() as a variant of WARN_ON(), however a few drivers are
using WARN() internally. This patch renames these to WARNING() to avoid the
namespace clash. A few cases were defining but not using the thing, for those
cases I just deleted the definition.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Acked-by: Greg KH <greg@kroah.com>
Cc: Karsten Keil <kkeil@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Building on the previous patches which took code from this driver and
pakaged it in more-reusable network "function" components, this patch
gets rid of the original code and uses those components instead.
As seen with the other gadget driver conversions, the resulting code
is much easier to understand and (presumably) work with. In this case
that's especially true, since the Ethernet gadget had grown to handle
three (!) different Ethernet-over-USB protocols. This modularization
should make it much easier to add a fourth option for the newish CDC
"Ethernet Emulation Model" (or EEM).
Lightly tested, primarily at full speed.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Some cleanup to the RNDIS code:
- Minor bugfix: rndis_unit() is supposed to put the link into the
RNDIS_UNINITIALIZED state, which does not mean "unused". There's
a separate method to stop using the link. (Bug doesn't affect
anything right now because of how the code is used.)
- Reduce coupling between RNDIS code and its user(s), in preparation
for updates in that code:
* Decouple RNDIS_RESPONSE_AVAILABLE notifications from net_device
by passing just a void* handle. (Also, remove the unused return
value of the notification callback.)
* When it needs a copy of net_device stats, just ask for it
- Remove unused/untested code backing various never-used OIDs:
* RNDIS_PM, RNDIS_WAKEUP ... "should" get implemented, but the
relevant docs were unclear, ambguous, and incomplete. Someone
with access to the Hidden Gospels (maybe in the EU?) might be
able to figure out what this should do.
* RNDIS_OPTIONAL_STATS ... as the name suggests, optional. Never
implemented in part because not all the semantics were clear.
* OID_GEN_RNDIS_CONFIG_PARAMETER, which has been #if 0 forever.
- A few small whitespace fixes
Plus switch the VERBOSE symbol over to the newer VERBOSE_DEBUG style.
There should be no functional changes because of this patch; it's a
net source code shrink (because of the dead/unused code removal) and
a small object code shrink (a couple hundred bytes on ARMv5).
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
The bus_id field is going away, use the dev_name() function instead.
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
The pxa2xx_udc.c driver is renamed to pxa25x_udc.c (the platform
driver name changes from pxa2xx-udc to pxa25x-udc) and the
platform driver name of pxa27x_udc.c is fixed to pxa27x-udc.
pxa_device_udc in devices.c is split into pxa25x and pxa27x flavors
and the pxa27x_device_udc is enabled in pxa27x.c.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Acked-by: Nicolas Pitre <nico@cam.org>
Acked-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Including from Ian Molton:
Fixes for mistakes left over from the PXA2{5,7}X UDC split.
Signed-off-by: Ian Molton <spyro@f2s.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Adds pxa27x udc driver to support USB peripherals on pxa27x chips.
The driver is compatible with: Gadget Zero, the File Storage
gadget, and the Ethernet gadget (only in CDC subset mode).
The driver can't properly support multiple interfaces, because
of hardware bugs without possible workaround. That means no
RNDIS support from g_ether, and no CDC ACM support in g_serial.
Signed-off-by: Robert Jarzmik <rjarzmik@free.fr>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
__FUNCTION__ is gcc-specific, use __func__
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Restore some section annotations: they were switched to "__devinit"
while they should have been "__init", because of bogus warnings. The
warnings are now fixed, so the runtime footprint of various drivers
can now shrink a bit. On ARMv5, it's about 600 bytes except for the
Ethernet gadget, where it can save a bit more.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
commit 0cf4f2de0a introduced a bug, which
prevents sending an USB_CDC_GET_ENCAPSULATED_RESPONSE message. This
breaks the RNDIS initialization (especially / only Windoze machines
dislike this behavior...).
Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
Signed-off-by: Jan Altenberg <jan.altenberg@linutronix.de>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Fix potential (never-observed) oops on rare error path,
bugzilla #9594. Fix uses the same test as used earlier.
Also make the adjacent "else" block look like an "else" block
instead of hiding like a bug.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Move <linux/usb_gadget.h> to <linux/usb/gadget.h>, reducing
some of the clutter in the main include directory.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>