You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (229 commits) USB: remove unused usb_buffer_alloc and usb_buffer_free macros usb: musb: update gfp/slab.h includes USB: ftdi_sio: fix legacy SIO-device header USB: kl5usb105: reimplement using generic framework USB: kl5usb105: minor clean ups USB: kl5usb105: fix memory leak USB: io_ti: use kfifo to implement write buffering USB: io_ti: remove unsused private counter USB: ti_usb: use kfifo to implement write buffering USB: ir-usb: fix incorrect write-buffer length USB: aircable: fix incorrect write-buffer length USB: safe_serial: straighten out read processing USB: safe_serial: reimplement read using generic framework USB: safe_serial: reimplement write using generic framework usb-storage: always print quirks USB: usb-storage: trivial debug improvements USB: oti6858: use port write fifo USB: oti6858: use kfifo to implement write buffering USB: cypress_m8: use kfifo to implement write buffering USB: cypress_m8: remove unused drain define ... Fix up conflicts (due to usb_buffer_alloc/free renaming) in drivers/input/tablet/acecad.c drivers/input/tablet/kbtab.c drivers/input/tablet/wacom_sys.c drivers/media/video/gspca/gspca.c sound/usb/usbaudio.c
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
What: /sys/bus/usb/devices/.../power/level
|
||||
Date: March 2007
|
||||
KernelVersion: 2.6.21
|
||||
Contact: Alan Stern <stern@rowland.harvard.edu>
|
||||
Description:
|
||||
Each USB device directory will contain a file named
|
||||
power/level. This file holds a power-level setting for
|
||||
the device, either "on" or "auto".
|
||||
|
||||
"on" means that the device is not allowed to autosuspend,
|
||||
although normal suspends for system sleep will still
|
||||
be honored. "auto" means the device will autosuspend
|
||||
and autoresume in the usual manner, according to the
|
||||
capabilities of its driver.
|
||||
|
||||
During normal use, devices should be left in the "auto"
|
||||
level. The "on" level is meant for administrative uses.
|
||||
If you want to suspend a device immediately but leave it
|
||||
free to wake up in response to I/O requests, you should
|
||||
write "0" to power/autosuspend.
|
||||
|
||||
Device not capable of proper suspend and resume should be
|
||||
left in the "on" level. Although the USB spec requires
|
||||
devices to support suspend/resume, many of them do not.
|
||||
In fact so many don't that by default, the USB core
|
||||
initializes all non-hub devices in the "on" level. Some
|
||||
drivers may change this setting when they are bound.
|
||||
|
||||
This file is deprecated and will be removed after 2010.
|
||||
Use the power/control file instead; it does exactly the
|
||||
same thing.
|
||||
@@ -14,34 +14,6 @@ Description:
|
||||
The autosuspend delay for newly-created devices is set to
|
||||
the value of the usbcore.autosuspend module parameter.
|
||||
|
||||
What: /sys/bus/usb/devices/.../power/level
|
||||
Date: March 2007
|
||||
KernelVersion: 2.6.21
|
||||
Contact: Alan Stern <stern@rowland.harvard.edu>
|
||||
Description:
|
||||
Each USB device directory will contain a file named
|
||||
power/level. This file holds a power-level setting for
|
||||
the device, either "on" or "auto".
|
||||
|
||||
"on" means that the device is not allowed to autosuspend,
|
||||
although normal suspends for system sleep will still
|
||||
be honored. "auto" means the device will autosuspend
|
||||
and autoresume in the usual manner, according to the
|
||||
capabilities of its driver.
|
||||
|
||||
During normal use, devices should be left in the "auto"
|
||||
level. The "on" level is meant for administrative uses.
|
||||
If you want to suspend a device immediately but leave it
|
||||
free to wake up in response to I/O requests, you should
|
||||
write "0" to power/autosuspend.
|
||||
|
||||
Device not capable of proper suspend and resume should be
|
||||
left in the "on" level. Although the USB spec requires
|
||||
devices to support suspend/resume, many of them do not.
|
||||
In fact so many don't that by default, the USB core
|
||||
initializes all non-hub devices in the "on" level. Some
|
||||
drivers may change this setting when they are bound.
|
||||
|
||||
What: /sys/bus/usb/devices/.../power/persist
|
||||
Date: May 2007
|
||||
KernelVersion: 2.6.23
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
What: /sys/devices/platform/_UDC_/gadget/suspended
|
||||
Date: April 2010
|
||||
Contact: Fabien Chouteau <fabien.chouteau@barco.com>
|
||||
Description:
|
||||
Show the suspend state of an USB composite gadget.
|
||||
1 -> suspended
|
||||
0 -> resumed
|
||||
|
||||
(_UDC_ is the name of the USB Device Controller driver)
|
||||
@@ -342,7 +342,7 @@ static inline void skel_delete (struct usb_skel *dev)
|
||||
{
|
||||
kfree (dev->bulk_in_buffer);
|
||||
if (dev->bulk_out_buffer != NULL)
|
||||
usb_buffer_free (dev->udev, dev->bulk_out_size,
|
||||
usb_free_coherent (dev->udev, dev->bulk_out_size,
|
||||
dev->bulk_out_buffer,
|
||||
dev->write_urb->transfer_dma);
|
||||
usb_free_urb (dev->write_urb);
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
Background
|
||||
==========
|
||||
|
||||
Bulk endpoint streams were added in the USB 3.0 specification. Streams allow a
|
||||
device driver to overload a bulk endpoint so that multiple transfers can be
|
||||
queued at once.
|
||||
|
||||
Streams are defined in sections 4.4.6.4 and 8.12.1.4 of the Universal Serial Bus
|
||||
3.0 specification at http://www.usb.org/developers/docs/ The USB Attached SCSI
|
||||
Protocol, which uses streams to queue multiple SCSI commands, can be found on
|
||||
the T10 website (http://t10.org/).
|
||||
|
||||
|
||||
Device-side implications
|
||||
========================
|
||||
|
||||
Once a buffer has been queued to a stream ring, the device is notified (through
|
||||
an out-of-band mechanism on another endpoint) that data is ready for that stream
|
||||
ID. The device then tells the host which "stream" it wants to start. The host
|
||||
can also initiate a transfer on a stream without the device asking, but the
|
||||
device can refuse that transfer. Devices can switch between streams at any
|
||||
time.
|
||||
|
||||
|
||||
Driver implications
|
||||
===================
|
||||
|
||||
int usb_alloc_streams(struct usb_interface *interface,
|
||||
struct usb_host_endpoint **eps, unsigned int num_eps,
|
||||
unsigned int num_streams, gfp_t mem_flags);
|
||||
|
||||
Device drivers will call this API to request that the host controller driver
|
||||
allocate memory so the driver can use up to num_streams stream IDs. They must
|
||||
pass an array of usb_host_endpoints that need to be setup with similar stream
|
||||
IDs. This is to ensure that a UASP driver will be able to use the same stream
|
||||
ID for the bulk IN and OUT endpoints used in a Bi-directional command sequence.
|
||||
|
||||
The return value is an error condition (if one of the endpoints doesn't support
|
||||
streams, or the xHCI driver ran out of memory), or the number of streams the
|
||||
host controller allocated for this endpoint. The xHCI host controller hardware
|
||||
declares how many stream IDs it can support, and each bulk endpoint on a
|
||||
SuperSpeed device will say how many stream IDs it can handle. Therefore,
|
||||
drivers should be able to deal with being allocated less stream IDs than they
|
||||
requested.
|
||||
|
||||
Do NOT call this function if you have URBs enqueued for any of the endpoints
|
||||
passed in as arguments. Do not call this function to request less than two
|
||||
streams.
|
||||
|
||||
Drivers will only be allowed to call this API once for the same endpoint
|
||||
without calling usb_free_streams(). This is a simplification for the xHCI host
|
||||
controller driver, and may change in the future.
|
||||
|
||||
|
||||
Picking new Stream IDs to use
|
||||
============================
|
||||
|
||||
Stream ID 0 is reserved, and should not be used to communicate with devices. If
|
||||
usb_alloc_streams() returns with a value of N, you may use streams 1 though N.
|
||||
To queue an URB for a specific stream, set the urb->stream_id value. If the
|
||||
endpoint does not support streams, an error will be returned.
|
||||
|
||||
Note that new API to choose the next stream ID will have to be added if the xHCI
|
||||
driver supports secondary stream IDs.
|
||||
|
||||
|
||||
Clean up
|
||||
========
|
||||
|
||||
If a driver wishes to stop using streams to communicate with the device, it
|
||||
should call
|
||||
|
||||
void usb_free_streams(struct usb_interface *interface,
|
||||
struct usb_host_endpoint **eps, unsigned int num_eps,
|
||||
gfp_t mem_flags);
|
||||
|
||||
All stream IDs will be deallocated when the driver releases the interface, to
|
||||
ensure that drivers that don't support streams will be able to use the endpoint.
|
||||
@@ -16,11 +16,11 @@ OR: they can now be DMA-aware.
|
||||
manage dma mappings for existing dma-ready buffers (see below).
|
||||
|
||||
- URBs have an additional "transfer_dma" field, as well as a transfer_flags
|
||||
bit saying if it's valid. (Control requests also have "setup_dma" and a
|
||||
corresponding transfer_flags bit.)
|
||||
bit saying if it's valid. (Control requests also have "setup_dma", but
|
||||
drivers must not use it.)
|
||||
|
||||
- "usbcore" will map those DMA addresses, if a DMA-aware driver didn't do
|
||||
it first and set URB_NO_TRANSFER_DMA_MAP or URB_NO_SETUP_DMA_MAP. HCDs
|
||||
- "usbcore" will map this DMA address, if a DMA-aware driver didn't do
|
||||
it first and set URB_NO_TRANSFER_DMA_MAP. HCDs
|
||||
don't manage dma mappings for URBs.
|
||||
|
||||
- There's a new "generic DMA API", parts of which are usable by USB device
|
||||
@@ -43,22 +43,16 @@ and effects like cache-trashing can impose subtle penalties.
|
||||
kind of addresses to store in urb->transfer_buffer and urb->transfer_dma.
|
||||
You'd also set URB_NO_TRANSFER_DMA_MAP in urb->transfer_flags:
|
||||
|
||||
void *usb_buffer_alloc (struct usb_device *dev, size_t size,
|
||||
void *usb_alloc_coherent (struct usb_device *dev, size_t size,
|
||||
int mem_flags, dma_addr_t *dma);
|
||||
|
||||
void usb_buffer_free (struct usb_device *dev, size_t size,
|
||||
void usb_free_coherent (struct usb_device *dev, size_t size,
|
||||
void *addr, dma_addr_t dma);
|
||||
|
||||
Most drivers should *NOT* be using these primitives; they don't need
|
||||
to use this type of memory ("dma-coherent"), and memory returned from
|
||||
kmalloc() will work just fine.
|
||||
|
||||
For control transfers you can use the buffer primitives or not for each
|
||||
of the transfer buffer and setup buffer independently. Set the flag bits
|
||||
URB_NO_TRANSFER_DMA_MAP and URB_NO_SETUP_DMA_MAP to indicate which
|
||||
buffers you have prepared. For non-control transfers URB_NO_SETUP_DMA_MAP
|
||||
is ignored.
|
||||
|
||||
The memory buffer returned is "dma-coherent"; sometimes you might need to
|
||||
force a consistent memory access ordering by using memory barriers. It's
|
||||
not using a streaming DMA mapping, so it's good for small transfers on
|
||||
@@ -130,8 +124,8 @@ of Documentation/PCI/PCI-DMA-mapping.txt, titled "What memory is DMA-able?")
|
||||
void usb_buffer_unmap (struct urb *urb);
|
||||
|
||||
The calls manage urb->transfer_dma for you, and set URB_NO_TRANSFER_DMA_MAP
|
||||
so that usbcore won't map or unmap the buffer. The same goes for
|
||||
urb->setup_dma and URB_NO_SETUP_DMA_MAP for control requests.
|
||||
so that usbcore won't map or unmap the buffer. They cannot be used for
|
||||
setup_packet buffers in control requests.
|
||||
|
||||
Note that several of those interfaces are currently commented out, since
|
||||
they don't have current users. See the source code. Other than the dmasync
|
||||
|
||||
@@ -0,0 +1,445 @@
|
||||
|
||||
Linux USB HID gadget driver
|
||||
|
||||
Introduction
|
||||
|
||||
The HID Gadget driver provides emulation of USB Human Interface
|
||||
Devices (HID). The basic HID handling is done in the kernel,
|
||||
and HID reports can be sent/received through I/O on the
|
||||
/dev/hidgX character devices.
|
||||
|
||||
For more details about HID, see the developer page on
|
||||
http://www.usb.org/developers/hidpage/
|
||||
|
||||
Configuration
|
||||
|
||||
g_hid is a platform driver, so to use it you need to add
|
||||
struct platform_device(s) to your platform code defining the
|
||||
HID function descriptors you want to use - E.G. something
|
||||
like:
|
||||
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/usb/g_hid.h>
|
||||
|
||||
/* hid descriptor for a keyboard */
|
||||
static struct hidg_func_descriptor my_hid_data = {
|
||||
.subclass = 0, /* No subclass */
|
||||
.protocol = 1, /* Keyboard */
|
||||
.report_length = 8,
|
||||
.report_desc_length = 63,
|
||||
.report_desc = {
|
||||
0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
|
||||
0x09, 0x06, /* USAGE (Keyboard) */
|
||||
0xa1, 0x01, /* COLLECTION (Application) */
|
||||
0x05, 0x07, /* USAGE_PAGE (Keyboard) */
|
||||
0x19, 0xe0, /* USAGE_MINIMUM (Keyboard LeftControl) */
|
||||
0x29, 0xe7, /* USAGE_MAXIMUM (Keyboard Right GUI) */
|
||||
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
|
||||
0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
|
||||
0x75, 0x01, /* REPORT_SIZE (1) */
|
||||
0x95, 0x08, /* REPORT_COUNT (8) */
|
||||
0x81, 0x02, /* INPUT (Data,Var,Abs) */
|
||||
0x95, 0x01, /* REPORT_COUNT (1) */
|
||||
0x75, 0x08, /* REPORT_SIZE (8) */
|
||||
0x81, 0x03, /* INPUT (Cnst,Var,Abs) */
|
||||
0x95, 0x05, /* REPORT_COUNT (5) */
|
||||
0x75, 0x01, /* REPORT_SIZE (1) */
|
||||
0x05, 0x08, /* USAGE_PAGE (LEDs) */
|
||||
0x19, 0x01, /* USAGE_MINIMUM (Num Lock) */
|
||||
0x29, 0x05, /* USAGE_MAXIMUM (Kana) */
|
||||
0x91, 0x02, /* OUTPUT (Data,Var,Abs) */
|
||||
0x95, 0x01, /* REPORT_COUNT (1) */
|
||||
0x75, 0x03, /* REPORT_SIZE (3) */
|
||||
0x91, 0x03, /* OUTPUT (Cnst,Var,Abs) */
|
||||
0x95, 0x06, /* REPORT_COUNT (6) */
|
||||
0x75, 0x08, /* REPORT_SIZE (8) */
|
||||
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
|
||||
0x25, 0x65, /* LOGICAL_MAXIMUM (101) */
|
||||
0x05, 0x07, /* USAGE_PAGE (Keyboard) */
|
||||
0x19, 0x00, /* USAGE_MINIMUM (Reserved) */
|
||||
0x29, 0x65, /* USAGE_MAXIMUM (Keyboard Application) */
|
||||
0x81, 0x00, /* INPUT (Data,Ary,Abs) */
|
||||
0xc0 /* END_COLLECTION */
|
||||
}
|
||||
};
|
||||
|
||||
static struct platform_device my_hid = {
|
||||
.name = "hidg",
|
||||
.id = 0,
|
||||
.num_resources = 0,
|
||||
.resource = 0,
|
||||
.dev.platform_data = &my_hid_data,
|
||||
};
|
||||
|
||||
You can add as many HID functions as you want, only limited by
|
||||
the amount of interrupt endpoints your gadget driver supports.
|
||||
|
||||
Send and receive HID reports
|
||||
|
||||
HID reports can be sent/received using read/write on the
|
||||
/dev/hidgX character devices. See below for an example program
|
||||
to do this.
|
||||
|
||||
hid_gadget_test is a small interactive program to test the HID
|
||||
gadget driver. To use, point it at a hidg device and set the
|
||||
device type (keyboard / mouse / joystick) - E.G.:
|
||||
|
||||
# hid_gadget_test /dev/hidg0 keyboard
|
||||
|
||||
You are now in the prompt of hid_gadget_test. You can type any
|
||||
combination of options and values. Available options and
|
||||
values are listed at program start. In keyboard mode you can
|
||||
send up to six values.
|
||||
|
||||
For example type: g i s t r --left-shift
|
||||
|
||||
Hit return and the corresponding report will be sent by the
|
||||
HID gadget.
|
||||
|
||||
Another interesting example is the caps lock test. Type
|
||||
-–caps-lock and hit return. A report is then sent by the
|
||||
gadget and you should receive the host answer, corresponding
|
||||
to the caps lock LED status.
|
||||
|
||||
--caps-lock
|
||||
recv report:2
|
||||
|
||||
With this command:
|
||||
|
||||
# hid_gadget_test /dev/hidg1 mouse
|
||||
|
||||
You can test the mouse emulation. Values are two signed numbers.
|
||||
|
||||
|
||||
Sample code
|
||||
|
||||
/* hid_gadget_test */
|
||||
|
||||
#include <pthread.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define BUF_LEN 512
|
||||
|
||||
struct options {
|
||||
const char *opt;
|
||||
unsigned char val;
|
||||
};
|
||||
|
||||
static struct options kmod[] = {
|
||||
{.opt = "--left-ctrl", .val = 0x01},
|
||||
{.opt = "--right-ctrl", .val = 0x10},
|
||||
{.opt = "--left-shift", .val = 0x02},
|
||||
{.opt = "--right-shift", .val = 0x20},
|
||||
{.opt = "--left-alt", .val = 0x04},
|
||||
{.opt = "--right-alt", .val = 0x40},
|
||||
{.opt = "--left-meta", .val = 0x08},
|
||||
{.opt = "--right-meta", .val = 0x80},
|
||||
{.opt = NULL}
|
||||
};
|
||||
|
||||
static struct options kval[] = {
|
||||
{.opt = "--return", .val = 0x28},
|
||||
{.opt = "--esc", .val = 0x29},
|
||||
{.opt = "--bckspc", .val = 0x2a},
|
||||
{.opt = "--tab", .val = 0x2b},
|
||||
{.opt = "--spacebar", .val = 0x2c},
|
||||
{.opt = "--caps-lock", .val = 0x39},
|
||||
{.opt = "--f1", .val = 0x3a},
|
||||
{.opt = "--f2", .val = 0x3b},
|
||||
{.opt = "--f3", .val = 0x3c},
|
||||
{.opt = "--f4", .val = 0x3d},
|
||||
{.opt = "--f5", .val = 0x3e},
|
||||
{.opt = "--f6", .val = 0x3f},
|
||||
{.opt = "--f7", .val = 0x40},
|
||||
{.opt = "--f8", .val = 0x41},
|
||||
{.opt = "--f9", .val = 0x42},
|
||||
{.opt = "--f10", .val = 0x43},
|
||||
{.opt = "--f11", .val = 0x44},
|
||||
{.opt = "--f12", .val = 0x45},
|
||||
{.opt = "--insert", .val = 0x49},
|
||||
{.opt = "--home", .val = 0x4a},
|
||||
{.opt = "--pageup", .val = 0x4b},
|
||||
{.opt = "--del", .val = 0x4c},
|
||||
{.opt = "--end", .val = 0x4d},
|
||||
{.opt = "--pagedown", .val = 0x4e},
|
||||
{.opt = "--right", .val = 0x4f},
|
||||
{.opt = "--left", .val = 0x50},
|
||||
{.opt = "--down", .val = 0x51},
|
||||
{.opt = "--kp-enter", .val = 0x58},
|
||||
{.opt = "--up", .val = 0x52},
|
||||
{.opt = "--num-lock", .val = 0x53},
|
||||
{.opt = NULL}
|
||||
};
|
||||
|
||||
int keyboard_fill_report(char report[8], char buf[BUF_LEN], int *hold)
|
||||
{
|
||||
char *tok = strtok(buf, " ");
|
||||
int key = 0;
|
||||
int i = 0;
|
||||
|
||||
for (; tok != NULL; tok = strtok(NULL, " ")) {
|
||||
|
||||
if (strcmp(tok, "--quit") == 0)
|
||||
return -1;
|
||||
|
||||
if (strcmp(tok, "--hold") == 0) {
|
||||
*hold = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (key < 6) {
|
||||
for (i = 0; kval[i].opt != NULL; i++)
|
||||
if (strcmp(tok, kval[i].opt) == 0) {
|
||||
report[2 + key++] = kval[i].val;
|
||||
break;
|
||||
}
|
||||
if (kval[i].opt != NULL)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (key < 6)
|
||||
if (islower(tok[0])) {
|
||||
report[2 + key++] = (tok[0] - ('a' - 0x04));
|
||||
continue;
|
||||
}
|
||||
|
||||
for (i = 0; kmod[i].opt != NULL; i++)
|
||||
if (strcmp(tok, kmod[i].opt) == 0) {
|
||||
report[0] = report[0] | kmod[i].val;
|
||||
break;
|
||||
}
|
||||
if (kmod[i].opt != NULL)
|
||||
continue;
|
||||
|
||||
if (key < 6)
|
||||
fprintf(stderr, "unknown option: %s\n", tok);
|
||||
}
|
||||
return 8;
|
||||
}
|
||||
|
||||
static struct options mmod[] = {
|
||||
{.opt = "--b1", .val = 0x01},
|
||||
{.opt = "--b2", .val = 0x02},
|
||||
{.opt = "--b3", .val = 0x04},
|
||||
{.opt = NULL}
|
||||
};
|
||||
|
||||
int mouse_fill_report(char report[8], char buf[BUF_LEN], int *hold)
|
||||
{
|
||||
char *tok = strtok(buf, " ");
|
||||
int mvt = 0;
|
||||
int i = 0;
|
||||
for (; tok != NULL; tok = strtok(NULL, " ")) {
|
||||
|
||||
if (strcmp(tok, "--quit") == 0)
|
||||
return -1;
|
||||
|
||||
if (strcmp(tok, "--hold") == 0) {
|
||||
*hold = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
for (i = 0; mmod[i].opt != NULL; i++)
|
||||
if (strcmp(tok, mmod[i].opt) == 0) {
|
||||
report[0] = report[0] | mmod[i].val;
|
||||
break;
|
||||
}
|
||||
if (mmod[i].opt != NULL)
|
||||
continue;
|
||||
|
||||
if (!(tok[0] == '-' && tok[1] == '-') && mvt < 2) {
|
||||
errno = 0;
|
||||
report[1 + mvt++] = (char)strtol(tok, NULL, 0);
|
||||
if (errno != 0) {
|
||||
fprintf(stderr, "Bad value:'%s'\n", tok);
|
||||
report[1 + mvt--] = 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
fprintf(stderr, "unknown option: %s\n", tok);
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
|
||||
static struct options jmod[] = {
|
||||
{.opt = "--b1", .val = 0x10},
|
||||
{.opt = "--b2", .val = 0x20},
|
||||
{.opt = "--b3", .val = 0x40},
|
||||
{.opt = "--b4", .val = 0x80},
|
||||
{.opt = "--hat1", .val = 0x00},
|
||||
{.opt = "--hat2", .val = 0x01},
|
||||
{.opt = "--hat3", .val = 0x02},
|
||||
{.opt = "--hat4", .val = 0x03},
|
||||
{.opt = "--hatneutral", .val = 0x04},
|
||||
{.opt = NULL}
|
||||
};
|
||||
|
||||
int joystick_fill_report(char report[8], char buf[BUF_LEN], int *hold)
|
||||
{
|
||||
char *tok = strtok(buf, " ");
|
||||
int mvt = 0;
|
||||
int i = 0;
|
||||
|
||||
*hold = 1;
|
||||
|
||||
/* set default hat position: neutral */
|
||||
report[3] = 0x04;
|
||||
|
||||
for (; tok != NULL; tok = strtok(NULL, " ")) {
|
||||
|
||||
if (strcmp(tok, "--quit") == 0)
|
||||
return -1;
|
||||
|
||||
for (i = 0; jmod[i].opt != NULL; i++)
|
||||
if (strcmp(tok, jmod[i].opt) == 0) {
|
||||
report[3] = (report[3] & 0xF0) | jmod[i].val;
|
||||
break;
|
||||
}
|
||||
if (jmod[i].opt != NULL)
|
||||
continue;
|
||||
|
||||
if (!(tok[0] == '-' && tok[1] == '-') && mvt < 3) {
|
||||
errno = 0;
|
||||
report[mvt++] = (char)strtol(tok, NULL, 0);
|
||||
if (errno != 0) {
|
||||
fprintf(stderr, "Bad value:'%s'\n", tok);
|
||||
report[mvt--] = 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
fprintf(stderr, "unknown option: %s\n", tok);
|
||||
}
|
||||
return 4;
|
||||
}
|
||||
|
||||
void print_options(char c)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if (c == 'k') {
|
||||
printf(" keyboard options:\n"
|
||||
" --hold\n");
|
||||
for (i = 0; kmod[i].opt != NULL; i++)
|
||||
printf("\t\t%s\n", kmod[i].opt);
|
||||
printf("\n keyboard values:\n"
|
||||
" [a-z] or\n");
|
||||
for (i = 0; kval[i].opt != NULL; i++)
|
||||
printf("\t\t%-8s%s", kval[i].opt, i % 2 ? "\n" : "");
|
||||
printf("\n");
|
||||
} else if (c == 'm') {
|
||||
printf(" mouse options:\n"
|
||||
" --hold\n");
|
||||
for (i = 0; mmod[i].opt != NULL; i++)
|
||||
printf("\t\t%s\n", mmod[i].opt);
|
||||
printf("\n mouse values:\n"
|
||||
" Two signed numbers\n"
|
||||
"--quit to close\n");
|
||||
} else {
|
||||
printf(" joystick options:\n");
|
||||
for (i = 0; jmod[i].opt != NULL; i++)
|
||||
printf("\t\t%s\n", jmod[i].opt);
|
||||
printf("\n joystick values:\n"
|
||||
" three signed numbers\n"
|
||||
"--quit to close\n");
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
const char *filename = NULL;
|
||||
int fd = 0;
|
||||
char buf[BUF_LEN];
|
||||
int cmd_len;
|
||||
char report[8];
|
||||
int to_send = 8;
|
||||
int hold = 0;
|
||||
fd_set rfds;
|
||||
int retval, i;
|
||||
|
||||
if (argc < 3) {
|
||||
fprintf(stderr, "Usage: %s devname mouse|keyboard|joystick\n",
|
||||
argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (argv[2][0] != 'k' && argv[2][0] != 'm' && argv[2][0] != 'j')
|
||||
return 2;
|
||||
|
||||
filename = argv[1];
|
||||
|
||||
if ((fd = open(filename, O_RDWR, 0666)) == -1) {
|
||||
perror(filename);
|
||||
return 3;
|
||||
}
|
||||
|
||||
print_options(argv[2][0]);
|
||||
|
||||
while (42) {
|
||||
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(STDIN_FILENO, &rfds);
|
||||
FD_SET(fd, &rfds);
|
||||
|
||||
retval = select(fd + 1, &rfds, NULL, NULL, NULL);
|
||||
if (retval == -1 && errno == EINTR)
|
||||
continue;
|
||||
if (retval < 0) {
|
||||
perror("select()");
|
||||
return 4;
|
||||
}
|
||||
|
||||
if (FD_ISSET(fd, &rfds)) {
|
||||
cmd_len = read(fd, buf, BUF_LEN - 1);
|
||||
printf("recv report:");
|
||||
for (i = 0; i < cmd_len; i++)
|
||||
printf(" %02x", buf[i]);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if (FD_ISSET(STDIN_FILENO, &rfds)) {
|
||||
memset(report, 0x0, sizeof(report));
|
||||
cmd_len = read(STDIN_FILENO, buf, BUF_LEN - 1);
|
||||
|
||||
if (cmd_len == 0)
|
||||
break;
|
||||
|
||||
buf[cmd_len - 1] = '\0';
|
||||
hold = 0;
|
||||
|
||||
memset(report, 0x0, sizeof(report));
|
||||
if (argv[2][0] == 'k')
|
||||
to_send = keyboard_fill_report(report, buf, &hold);
|
||||
else if (argv[2][0] == 'm')
|
||||
to_send = mouse_fill_report(report, buf, &hold);
|
||||
else
|
||||
to_send = joystick_fill_report(report, buf, &hold);
|
||||
|
||||
if (to_send == -1)
|
||||
break;
|
||||
|
||||
if (write(fd, report, to_send) != to_send) {
|
||||
perror(filename);
|
||||
return 5;
|
||||
}
|
||||
if (!hold) {
|
||||
memset(report, 0x0, sizeof(report));
|
||||
if (write(fd, report, to_send) != to_send) {
|
||||
perror(filename);
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
@@ -107,7 +107,9 @@ allowed to issue dynamic suspends.
|
||||
The user interface for controlling dynamic PM is located in the power/
|
||||
subdirectory of each USB device's sysfs directory, that is, in
|
||||
/sys/bus/usb/devices/.../power/ where "..." is the device's ID. The
|
||||
relevant attribute files are: wakeup, level, and autosuspend.
|
||||
relevant attribute files are: wakeup, control, and autosuspend.
|
||||
(There may also be a file named "level"; this file was deprecated
|
||||
as of the 2.6.35 kernel and replaced by the "control" file.)
|
||||
|
||||
power/wakeup
|
||||
|
||||
@@ -120,7 +122,7 @@ relevant attribute files are: wakeup, level, and autosuspend.
|
||||
while the device is suspended, the change won't take
|
||||
effect until the following suspend.)
|
||||
|
||||
power/level
|
||||
power/control
|
||||
|
||||
This file contains one of two words: "on" or "auto".
|
||||
You can write those words to the file to change the
|
||||
@@ -148,14 +150,15 @@ relevant attribute files are: wakeup, level, and autosuspend.
|
||||
never to autosuspend. You can write a number to the
|
||||
file to change the autosuspend idle-delay time.
|
||||
|
||||
Writing "-1" to power/autosuspend and writing "on" to power/level do
|
||||
Writing "-1" to power/autosuspend and writing "on" to power/control do
|
||||
essentially the same thing -- they both prevent the device from being
|
||||
autosuspended. Yes, this is a redundancy in the API.
|
||||
|
||||
(In 2.6.21 writing "0" to power/autosuspend would prevent the device
|
||||
from being autosuspended; the behavior was changed in 2.6.22. The
|
||||
power/autosuspend attribute did not exist prior to 2.6.21, and the
|
||||
power/level attribute did not exist prior to 2.6.22.)
|
||||
power/level attribute did not exist prior to 2.6.22. power/control
|
||||
was added in 2.6.34.)
|
||||
|
||||
|
||||
Changing the default idle-delay time
|
||||
@@ -212,7 +215,7 @@ among printers and scanners, but plenty of other types of device have
|
||||
the same deficiency.
|
||||
|
||||
For this reason, by default the kernel disables autosuspend (the
|
||||
power/level attribute is initialized to "on") for all devices other
|
||||
power/control attribute is initialized to "on") for all devices other
|
||||
than hubs. Hubs, at least, appear to be reasonably well-behaved in
|
||||
this regard.
|
||||
|
||||
@@ -373,7 +376,7 @@ usb_autopm_put_interface() in its close or release routine. But other
|
||||
patterns are possible.
|
||||
|
||||
The autosuspend attempts mentioned above will often fail for one
|
||||
reason or another. For example, the power/level attribute might be
|
||||
reason or another. For example, the power/control attribute might be
|
||||
set to "on", or another interface in the same device might not be
|
||||
idle. This is perfectly normal. If the reason for failure was that
|
||||
the device hasn't been idle for long enough, a timer is scheduled to
|
||||
@@ -394,12 +397,12 @@ Drivers can enable autosuspend for their devices by calling
|
||||
|
||||
in their probe() routine, if they know that the device is capable of
|
||||
suspending and resuming correctly. This is exactly equivalent to
|
||||
writing "auto" to the device's power/level attribute. Likewise,
|
||||
writing "auto" to the device's power/control attribute. Likewise,
|
||||
drivers can disable autosuspend by calling
|
||||
|
||||
usb_disable_autosuspend(struct usb_device *udev);
|
||||
|
||||
This is exactly the same as writing "on" to the power/level attribute.
|
||||
This is exactly the same as writing "on" to the power/control attribute.
|
||||
|
||||
Sometimes a driver needs to make sure that remote wakeup is enabled
|
||||
during autosuspend. For example, there's not much point
|
||||
|
||||
@@ -194,6 +194,10 @@ FTDI Single Port Serial Driver
|
||||
|
||||
This is a single port DB-25 serial adapter.
|
||||
|
||||
Devices supported include:
|
||||
-TripNav TN-200 USB GPS
|
||||
-Navis Engineering Bureau CH-4711 USB GPS
|
||||
|
||||
For any questions or problems with this driver, please contact Bill Ryder.
|
||||
|
||||
|
||||
@@ -216,7 +220,7 @@ Cypress M8 CY4601 Family Serial Driver
|
||||
|
||||
Devices supported:
|
||||
|
||||
-DeLorme's USB Earthmate (SiRF Star II lp arch)
|
||||
-DeLorme's USB Earthmate GPS (SiRF Star II lp arch)
|
||||
-Cypress HID->COM RS232 adapter
|
||||
|
||||
Note: Cypress Semiconductor claims no affiliation with the
|
||||
@@ -392,9 +396,10 @@ REINER SCT cyberJack pinpad/e-com USB chipcard reader
|
||||
Prolific PL2303 Driver
|
||||
|
||||
This driver supports any device that has the PL2303 chip from Prolific
|
||||
in it. This includes a number of single port USB to serial
|
||||
converters and USB GPS devices. Devices from Aten (the UC-232) and
|
||||
IO-Data work with this driver, as does the DCU-11 mobile-phone cable.
|
||||
in it. This includes a number of single port USB to serial converters,
|
||||
more than 70% of USB GPS devices (in 2010), and some USB UPSes. Devices
|
||||
from Aten (the UC-232) and IO-Data work with this driver, as does
|
||||
the DCU-11 mobile-phone cable.
|
||||
|
||||
For any questions or problems with this driver, please contact Greg
|
||||
Kroah-Hartman at greg@kroah.com
|
||||
@@ -435,6 +440,22 @@ Winchiphead CH341 Driver
|
||||
For any questions or problems with this driver, please contact
|
||||
frank@kingswood-consulting.co.uk.
|
||||
|
||||
Moschip MCS7720, MCS7715 driver
|
||||
|
||||
These chips are present in devices sold by various manufacturers, such as Syba
|
||||
and Cables Unlimited. There may be others. The 7720 provides two serial
|
||||
ports, and the 7715 provides one serial and one standard PC parallel port.
|
||||
Support for the 7715's parallel port is enabled by a separate option, which
|
||||
will not appear unless parallel port support is first enabled at the top-level
|
||||
of the Device Drivers config menu. Currently only compatibility mode is
|
||||
supported on the parallel port (no ECP/EPP).
|
||||
|
||||
TODO:
|
||||
- Implement ECP/EPP modes for the parallel port.
|
||||
- Baud rates higher than 115200 are currently broken.
|
||||
- Devices with a single serial port based on the Moschip MCS7703 may work
|
||||
with this driver with a simple addition to the usb_device_id table. I
|
||||
don't have one of these devices, so I can't say for sure.
|
||||
|
||||
Generic Serial driver
|
||||
|
||||
|
||||
@@ -702,6 +702,9 @@ static void __init omap3_evm_init(void)
|
||||
omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP);
|
||||
ehci_pdata.reset_gpio_port[1] = 21;
|
||||
|
||||
/* EVM REV >= E can supply 500mA with EXTVBUS programming */
|
||||
musb_board_data.power = 500;
|
||||
musb_board_data.extvbus = 1;
|
||||
} else {
|
||||
/* setup EHCI phy reset on MDC */
|
||||
omap_mux_init_gpio(135, OMAP_PIN_OUTPUT);
|
||||
|
||||
@@ -236,3 +236,158 @@ void __init usb_ehci_init(const struct ehci_hcd_omap_platform_data *pdata)
|
||||
|
||||
#endif /* CONFIG_USB_EHCI_HCD */
|
||||
|
||||
#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
|
||||
|
||||
static struct resource ohci_resources[] = {
|
||||
{
|
||||
.start = OMAP34XX_OHCI_BASE,
|
||||
.end = OMAP34XX_OHCI_BASE + SZ_1K - 1,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
{
|
||||
.start = OMAP34XX_UHH_CONFIG_BASE,
|
||||
.end = OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
{
|
||||
.start = OMAP34XX_USBTLL_BASE,
|
||||
.end = OMAP34XX_USBTLL_BASE + SZ_4K - 1,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
{ /* general IRQ */
|
||||
.start = INT_34XX_OHCI_IRQ,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
}
|
||||
};
|
||||
|
||||
static u64 ohci_dmamask = DMA_BIT_MASK(32);
|
||||
|
||||
static struct platform_device ohci_device = {
|
||||
.name = "ohci-omap3",
|
||||
.id = 0,
|
||||
.dev = {
|
||||
.dma_mask = &ohci_dmamask,
|
||||
.coherent_dma_mask = 0xffffffff,
|
||||
},
|
||||
.num_resources = ARRAY_SIZE(ohci_resources),
|
||||
.resource = ohci_resources,
|
||||
};
|
||||
|
||||
static void setup_ohci_io_mux(const enum ohci_omap3_port_mode *port_mode)
|
||||
{
|
||||
switch (port_mode[0]) {
|
||||
case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
|
||||
case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
|
||||
case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
|
||||
case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
|
||||
omap_mux_init_signal("mm1_rxdp",
|
||||
OMAP_PIN_INPUT_PULLDOWN);
|
||||
omap_mux_init_signal("mm1_rxdm",
|
||||
OMAP_PIN_INPUT_PULLDOWN);
|
||||
/* FALLTHROUGH */
|
||||
case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
|
||||
case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
|
||||
omap_mux_init_signal("mm1_rxrcv",
|
||||
OMAP_PIN_INPUT_PULLDOWN);
|
||||
/* FALLTHROUGH */
|
||||
case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
|
||||
case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
|
||||
omap_mux_init_signal("mm1_txen_n", OMAP_PIN_OUTPUT);
|
||||
/* FALLTHROUGH */
|
||||
case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
|
||||
case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
|
||||
omap_mux_init_signal("mm1_txse0",
|
||||
OMAP_PIN_INPUT_PULLDOWN);
|
||||
omap_mux_init_signal("mm1_txdat",
|
||||
OMAP_PIN_INPUT_PULLDOWN);
|
||||
break;
|
||||
case OMAP_OHCI_PORT_MODE_UNUSED:
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (port_mode[1]) {
|
||||
case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
|
||||
case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
|
||||
case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
|
||||
case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
|
||||
omap_mux_init_signal("mm2_rxdp",
|
||||
OMAP_PIN_INPUT_PULLDOWN);
|
||||
omap_mux_init_signal("mm2_rxdm",
|
||||
OMAP_PIN_INPUT_PULLDOWN);
|
||||
/* FALLTHROUGH */
|
||||
case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
|
||||
case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
|
||||
omap_mux_init_signal("mm2_rxrcv",
|
||||
OMAP_PIN_INPUT_PULLDOWN);
|
||||
/* FALLTHROUGH */
|
||||
case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
|
||||
case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
|
||||
omap_mux_init_signal("mm2_txen_n", OMAP_PIN_OUTPUT);
|
||||
/* FALLTHROUGH */
|
||||
case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
|
||||
case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
|
||||
omap_mux_init_signal("mm2_txse0",
|
||||
OMAP_PIN_INPUT_PULLDOWN);
|
||||
omap_mux_init_signal("mm2_txdat",
|
||||
OMAP_PIN_INPUT_PULLDOWN);
|
||||
break;
|
||||
case OMAP_OHCI_PORT_MODE_UNUSED:
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (port_mode[2]) {
|
||||
case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
|
||||
case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
|
||||
case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
|
||||
case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
|
||||
omap_mux_init_signal("mm3_rxdp",
|
||||
OMAP_PIN_INPUT_PULLDOWN);
|
||||
omap_mux_init_signal("mm3_rxdm",
|
||||
OMAP_PIN_INPUT_PULLDOWN);
|
||||
/* FALLTHROUGH */
|
||||
case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
|
||||
case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
|
||||
omap_mux_init_signal("mm3_rxrcv",
|
||||
OMAP_PIN_INPUT_PULLDOWN);
|
||||
/* FALLTHROUGH */
|
||||
case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
|
||||
case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
|
||||
omap_mux_init_signal("mm3_txen_n", OMAP_PIN_OUTPUT);
|
||||
/* FALLTHROUGH */
|
||||
case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
|
||||
case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
|
||||
omap_mux_init_signal("mm3_txse0",
|
||||
OMAP_PIN_INPUT_PULLDOWN);
|
||||
omap_mux_init_signal("mm3_txdat",
|
||||
OMAP_PIN_INPUT_PULLDOWN);
|
||||
break;
|
||||
case OMAP_OHCI_PORT_MODE_UNUSED:
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void __init usb_ohci_init(const struct ohci_hcd_omap_platform_data *pdata)
|
||||
{
|
||||
platform_device_add_data(&ohci_device, pdata, sizeof(*pdata));
|
||||
|
||||
/* Setup Pin IO MUX for OHCI */
|
||||
if (cpu_is_omap34xx())
|
||||
setup_ohci_io_mux(pdata->port_mode);
|
||||
|
||||
if (platform_device_register(&ohci_device) < 0) {
|
||||
pr_err("Unable to register FS-USB (OHCI) device\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void __init usb_ohci_init(const struct ohci_hcd_omap_platform_data *pdata)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* CONFIG_USB_OHCI_HCD */
|
||||
|
||||
@@ -107,6 +107,7 @@ void __init usb_musb_init(struct omap_musb_board_data *board_data)
|
||||
musb_plat.board_data = board_data;
|
||||
musb_plat.power = board_data->power >> 1;
|
||||
musb_plat.mode = board_data->mode;
|
||||
musb_plat.extvbus = board_data->extvbus;
|
||||
|
||||
if (platform_device_register(&musb_device) < 0)
|
||||
printk(KERN_ERR "Unable to register HS-USB (MUSB) device\n");
|
||||
|
||||
@@ -13,6 +13,20 @@ enum ehci_hcd_omap_mode {
|
||||
EHCI_HCD_OMAP_MODE_TLL,
|
||||
};
|
||||
|
||||
enum ohci_omap3_port_mode {
|
||||
OMAP_OHCI_PORT_MODE_UNUSED,
|
||||
OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0,
|
||||
OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM,
|
||||
OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0,
|
||||
OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM,
|
||||
OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0,
|
||||
OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM,
|
||||
OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0,
|
||||
OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM,
|
||||
OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0,
|
||||
OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM,
|
||||
};
|
||||
|
||||
struct ehci_hcd_omap_platform_data {
|
||||
enum ehci_hcd_omap_mode port_mode[OMAP3_HS_USB_PORTS];
|
||||
unsigned phy_reset:1;
|
||||
@@ -21,6 +35,13 @@ struct ehci_hcd_omap_platform_data {
|
||||
int reset_gpio_port[OMAP3_HS_USB_PORTS];
|
||||
};
|
||||
|
||||
struct ohci_hcd_omap_platform_data {
|
||||
enum ohci_omap3_port_mode port_mode[OMAP3_HS_USB_PORTS];
|
||||
|
||||
/* Set this to true for ES2.x silicon */
|
||||
unsigned es2_compatibility:1;
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
#define OMAP1_OTG_BASE 0xfffb0400
|
||||
@@ -47,6 +68,7 @@ struct omap_musb_board_data {
|
||||
u8 interface_type;
|
||||
u8 mode;
|
||||
u16 power;
|
||||
unsigned extvbus:1;
|
||||
};
|
||||
|
||||
enum musb_interface {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI};
|
||||
@@ -55,6 +77,8 @@ extern void usb_musb_init(struct omap_musb_board_data *board_data);
|
||||
|
||||
extern void usb_ehci_init(const struct ehci_hcd_omap_platform_data *pdata);
|
||||
|
||||
extern void usb_ohci_init(const struct ohci_hcd_omap_platform_data *pdata);
|
||||
|
||||
#endif
|
||||
|
||||
void omap_usb_init(struct omap_usb_config *pdata);
|
||||
|
||||
@@ -783,13 +783,12 @@ static int hid_alloc_buffers(struct usb_device *dev, struct hid_device *hid)
|
||||
{
|
||||
struct usbhid_device *usbhid = hid->driver_data;
|
||||
|
||||
usbhid->inbuf = usb_buffer_alloc(dev, usbhid->bufsize, GFP_KERNEL,
|
||||
usbhid->inbuf = usb_alloc_coherent(dev, usbhid->bufsize, GFP_KERNEL,
|
||||
&usbhid->inbuf_dma);
|
||||
usbhid->outbuf = usb_buffer_alloc(dev, usbhid->bufsize, GFP_KERNEL,
|
||||
usbhid->outbuf = usb_alloc_coherent(dev, usbhid->bufsize, GFP_KERNEL,
|
||||
&usbhid->outbuf_dma);
|
||||
usbhid->cr = usb_buffer_alloc(dev, sizeof(*usbhid->cr), GFP_KERNEL,
|
||||
&usbhid->cr_dma);
|
||||
usbhid->ctrlbuf = usb_buffer_alloc(dev, usbhid->bufsize, GFP_KERNEL,
|
||||
usbhid->cr = kmalloc(sizeof(*usbhid->cr), GFP_KERNEL);
|
||||
usbhid->ctrlbuf = usb_alloc_coherent(dev, usbhid->bufsize, GFP_KERNEL,
|
||||
&usbhid->ctrlbuf_dma);
|
||||
if (!usbhid->inbuf || !usbhid->outbuf || !usbhid->cr ||
|
||||
!usbhid->ctrlbuf)
|
||||
@@ -844,10 +843,10 @@ static void hid_free_buffers(struct usb_device *dev, struct hid_device *hid)
|
||||
{
|
||||
struct usbhid_device *usbhid = hid->driver_data;
|
||||
|
||||
usb_buffer_free(dev, usbhid->bufsize, usbhid->inbuf, usbhid->inbuf_dma);
|
||||
usb_buffer_free(dev, usbhid->bufsize, usbhid->outbuf, usbhid->outbuf_dma);
|
||||
usb_buffer_free(dev, sizeof(*(usbhid->cr)), usbhid->cr, usbhid->cr_dma);
|
||||
usb_buffer_free(dev, usbhid->bufsize, usbhid->ctrlbuf, usbhid->ctrlbuf_dma);
|
||||
usb_free_coherent(dev, usbhid->bufsize, usbhid->inbuf, usbhid->inbuf_dma);
|
||||
usb_free_coherent(dev, usbhid->bufsize, usbhid->outbuf, usbhid->outbuf_dma);
|
||||
kfree(usbhid->cr);
|
||||
usb_free_coherent(dev, usbhid->bufsize, usbhid->ctrlbuf, usbhid->ctrlbuf_dma);
|
||||
}
|
||||
|
||||
static int usbhid_parse(struct hid_device *hid)
|
||||
@@ -1007,9 +1006,8 @@ static int usbhid_start(struct hid_device *hid)
|
||||
|
||||
usb_fill_control_urb(usbhid->urbctrl, dev, 0, (void *) usbhid->cr,
|
||||
usbhid->ctrlbuf, 1, hid_ctrl, hid);
|
||||
usbhid->urbctrl->setup_dma = usbhid->cr_dma;
|
||||
usbhid->urbctrl->transfer_dma = usbhid->ctrlbuf_dma;
|
||||
usbhid->urbctrl->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP);
|
||||
usbhid->urbctrl->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
|
||||
|
||||
if (!(hid->quirks & HID_QUIRK_NO_INIT_REPORTS))
|
||||
usbhid_init_reports(hid);
|
||||
|
||||
@@ -75,7 +75,6 @@ struct usbhid_device {
|
||||
|
||||
struct urb *urbctrl; /* Control URB */
|
||||
struct usb_ctrlrequest *cr; /* Control request struct */
|
||||
dma_addr_t cr_dma; /* Control request struct dma */
|
||||
struct hid_control_fifo ctrl[HID_CONTROL_FIFO_SIZE]; /* Control fifo */
|
||||
unsigned char ctrlhead, ctrltail; /* Control fifo head & tail */
|
||||
char *ctrlbuf; /* Control buffer */
|
||||
|
||||
@@ -74,7 +74,6 @@ struct usb_kbd {
|
||||
unsigned char *new;
|
||||
struct usb_ctrlrequest *cr;
|
||||
unsigned char *leds;
|
||||
dma_addr_t cr_dma;
|
||||
dma_addr_t new_dma;
|
||||
dma_addr_t leds_dma;
|
||||
};
|
||||
@@ -197,11 +196,11 @@ static int usb_kbd_alloc_mem(struct usb_device *dev, struct usb_kbd *kbd)
|
||||
return -1;
|
||||
if (!(kbd->led = usb_alloc_urb(0, GFP_KERNEL)))
|
||||
return -1;
|
||||
if (!(kbd->new = usb_buffer_alloc(dev, 8, GFP_ATOMIC, &kbd->new_dma)))
|
||||
if (!(kbd->new = usb_alloc_coherent(dev, 8, GFP_ATOMIC, &kbd->new_dma)))
|
||||
return -1;
|
||||
if (!(kbd->cr = usb_buffer_alloc(dev, sizeof(struct usb_ctrlrequest), GFP_ATOMIC, &kbd->cr_dma)))
|
||||
if (!(kbd->cr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL)))
|
||||
return -1;
|
||||
if (!(kbd->leds = usb_buffer_alloc(dev, 1, GFP_ATOMIC, &kbd->leds_dma)))
|
||||
if (!(kbd->leds = usb_alloc_coherent(dev, 1, GFP_ATOMIC, &kbd->leds_dma)))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
@@ -211,9 +210,9 @@ static void usb_kbd_free_mem(struct usb_device *dev, struct usb_kbd *kbd)
|
||||
{
|
||||
usb_free_urb(kbd->irq);
|
||||
usb_free_urb(kbd->led);
|
||||
usb_buffer_free(dev, 8, kbd->new, kbd->new_dma);
|
||||
usb_buffer_free(dev, sizeof(struct usb_ctrlrequest), kbd->cr, kbd->cr_dma);
|
||||
usb_buffer_free(dev, 1, kbd->leds, kbd->leds_dma);
|
||||
usb_free_coherent(dev, 8, kbd->new, kbd->new_dma);
|
||||
kfree(kbd->cr);
|
||||
usb_free_coherent(dev, 1, kbd->leds, kbd->leds_dma);
|
||||
}
|
||||
|
||||
static int usb_kbd_probe(struct usb_interface *iface,
|
||||
@@ -304,9 +303,8 @@ static int usb_kbd_probe(struct usb_interface *iface,
|
||||
usb_fill_control_urb(kbd->led, dev, usb_sndctrlpipe(dev, 0),
|
||||
(void *) kbd->cr, kbd->leds, 1,
|
||||
usb_kbd_led, kbd);
|
||||
kbd->led->setup_dma = kbd->cr_dma;
|
||||
kbd->led->transfer_dma = kbd->leds_dma;
|
||||
kbd->led->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP);
|
||||
kbd->led->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
|
||||
|
||||
error = input_register_device(kbd->dev);
|
||||
if (error)
|
||||
|
||||
@@ -142,7 +142,7 @@ static int usb_mouse_probe(struct usb_interface *intf, const struct usb_device_i
|
||||
if (!mouse || !input_dev)
|
||||
goto fail1;
|
||||
|
||||
mouse->data = usb_buffer_alloc(dev, 8, GFP_ATOMIC, &mouse->data_dma);
|
||||
mouse->data = usb_alloc_coherent(dev, 8, GFP_ATOMIC, &mouse->data_dma);
|
||||
if (!mouse->data)
|
||||
goto fail1;
|
||||
|
||||
@@ -205,7 +205,7 @@ static int usb_mouse_probe(struct usb_interface *intf, const struct usb_device_i
|
||||
fail3:
|
||||
usb_free_urb(mouse->irq);
|
||||
fail2:
|
||||
usb_buffer_free(dev, 8, mouse->data, mouse->data_dma);
|
||||
usb_free_coherent(dev, 8, mouse->data, mouse->data_dma);
|
||||
fail1:
|
||||
input_free_device(input_dev);
|
||||
kfree(mouse);
|
||||
@@ -221,7 +221,7 @@ static void usb_mouse_disconnect(struct usb_interface *intf)
|
||||
usb_kill_urb(mouse->irq);
|
||||
input_unregister_device(mouse->dev);
|
||||
usb_free_urb(mouse->irq);
|
||||
usb_buffer_free(interface_to_usbdev(intf), 8, mouse->data, mouse->data_dma);
|
||||
usb_free_coherent(interface_to_usbdev(intf), 8, mouse->data, mouse->data_dma);
|
||||
kfree(mouse);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -533,8 +533,8 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad)
|
||||
if (xpad->xtype != XTYPE_XBOX360 && xpad->xtype != XTYPE_XBOX)
|
||||
return 0;
|
||||
|
||||
xpad->odata = usb_buffer_alloc(xpad->udev, XPAD_PKT_LEN,
|
||||
GFP_KERNEL, &xpad->odata_dma);
|
||||
xpad->odata = usb_alloc_coherent(xpad->udev, XPAD_PKT_LEN,
|
||||
GFP_KERNEL, &xpad->odata_dma);
|
||||
if (!xpad->odata)
|
||||
goto fail1;
|
||||
|
||||
@@ -554,7 +554,7 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad)
|
||||
|
||||
return 0;
|
||||
|
||||
fail2: usb_buffer_free(xpad->udev, XPAD_PKT_LEN, xpad->odata, xpad->odata_dma);
|
||||
fail2: usb_free_coherent(xpad->udev, XPAD_PKT_LEN, xpad->odata, xpad->odata_dma);
|
||||
fail1: return error;
|
||||
}
|
||||
|
||||
@@ -568,7 +568,7 @@ static void xpad_deinit_output(struct usb_xpad *xpad)
|
||||
{
|
||||
if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX) {
|
||||
usb_free_urb(xpad->irq_out);
|
||||
usb_buffer_free(xpad->udev, XPAD_PKT_LEN,
|
||||
usb_free_coherent(xpad->udev, XPAD_PKT_LEN,
|
||||
xpad->odata, xpad->odata_dma);
|
||||
}
|
||||
}
|
||||
@@ -788,8 +788,8 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
|
||||
if (!xpad || !input_dev)
|
||||
goto fail1;
|
||||
|
||||
xpad->idata = usb_buffer_alloc(udev, XPAD_PKT_LEN,
|
||||
GFP_KERNEL, &xpad->idata_dma);
|
||||
xpad->idata = usb_alloc_coherent(udev, XPAD_PKT_LEN,
|
||||
GFP_KERNEL, &xpad->idata_dma);
|
||||
if (!xpad->idata)
|
||||
goto fail1;
|
||||
|
||||
@@ -942,7 +942,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
|
||||
fail5: usb_kill_urb(xpad->irq_in);
|
||||
fail4: usb_free_urb(xpad->irq_in);
|
||||
fail3: xpad_deinit_output(xpad);
|
||||
fail2: usb_buffer_free(udev, XPAD_PKT_LEN, xpad->idata, xpad->idata_dma);
|
||||
fail2: usb_free_coherent(udev, XPAD_PKT_LEN, xpad->idata, xpad->idata_dma);
|
||||
fail1: input_free_device(input_dev);
|
||||
kfree(xpad);
|
||||
return error;
|
||||
@@ -964,7 +964,7 @@ static void xpad_disconnect(struct usb_interface *intf)
|
||||
usb_kill_urb(xpad->irq_in);
|
||||
}
|
||||
usb_free_urb(xpad->irq_in);
|
||||
usb_buffer_free(xpad->udev, XPAD_PKT_LEN,
|
||||
usb_free_coherent(xpad->udev, XPAD_PKT_LEN,
|
||||
xpad->idata, xpad->idata_dma);
|
||||
kfree(xpad);
|
||||
}
|
||||
|
||||
@@ -624,13 +624,13 @@ static void ati_remote_irq_in(struct urb *urb)
|
||||
static int ati_remote_alloc_buffers(struct usb_device *udev,
|
||||
struct ati_remote *ati_remote)
|
||||
{
|
||||
ati_remote->inbuf = usb_buffer_alloc(udev, DATA_BUFSIZE, GFP_ATOMIC,
|
||||
&ati_remote->inbuf_dma);
|
||||
ati_remote->inbuf = usb_alloc_coherent(udev, DATA_BUFSIZE, GFP_ATOMIC,
|
||||
&ati_remote->inbuf_dma);
|
||||
if (!ati_remote->inbuf)
|
||||
return -1;
|
||||
|
||||
ati_remote->outbuf = usb_buffer_alloc(udev, DATA_BUFSIZE, GFP_ATOMIC,
|
||||
&ati_remote->outbuf_dma);
|
||||
ati_remote->outbuf = usb_alloc_coherent(udev, DATA_BUFSIZE, GFP_ATOMIC,
|
||||
&ati_remote->outbuf_dma);
|
||||
if (!ati_remote->outbuf)
|
||||
return -1;
|
||||
|
||||
@@ -653,10 +653,10 @@ static void ati_remote_free_buffers(struct ati_remote *ati_remote)
|
||||
usb_free_urb(ati_remote->irq_urb);
|
||||
usb_free_urb(ati_remote->out_urb);
|
||||
|
||||
usb_buffer_free(ati_remote->udev, DATA_BUFSIZE,
|
||||
usb_free_coherent(ati_remote->udev, DATA_BUFSIZE,
|
||||
ati_remote->inbuf, ati_remote->inbuf_dma);
|
||||
|
||||
usb_buffer_free(ati_remote->udev, DATA_BUFSIZE,
|
||||
usb_free_coherent(ati_remote->udev, DATA_BUFSIZE,
|
||||
ati_remote->outbuf, ati_remote->outbuf_dma);
|
||||
}
|
||||
|
||||
|
||||
@@ -589,7 +589,7 @@ static int ati_remote2_urb_init(struct ati_remote2 *ar2)
|
||||
int i, pipe, maxp;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
ar2->buf[i] = usb_buffer_alloc(udev, 4, GFP_KERNEL, &ar2->buf_dma[i]);
|
||||
ar2->buf[i] = usb_alloc_coherent(udev, 4, GFP_KERNEL, &ar2->buf_dma[i]);
|
||||
if (!ar2->buf[i])
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -617,7 +617,7 @@ static void ati_remote2_urb_cleanup(struct ati_remote2 *ar2)
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
usb_free_urb(ar2->urb[i]);
|
||||
usb_buffer_free(ar2->udev, 4, ar2->buf[i], ar2->buf_dma[i]);
|
||||
usb_free_coherent(ar2->udev, 4, ar2->buf[i], ar2->buf_dma[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user