diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-arm/arch-at91/board.h | 3 | ||||
-rw-r--r-- | include/asm-arm/mach/udc_pxa2xx.h | 2 | ||||
-rw-r--r-- | include/linux/aspm.h | 44 | ||||
-rw-r--r-- | include/linux/pci-acpi.h | 11 | ||||
-rw-r--r-- | include/linux/pci.h | 367 | ||||
-rw-r--r-- | include/linux/pci_regs.h | 8 | ||||
-rw-r--r-- | include/linux/usb.h | 209 | ||||
-rw-r--r-- | include/linux/usb/Kbuild | 11 | ||||
-rw-r--r-- | include/linux/usb/audio.h | 14 | ||||
-rw-r--r-- | include/linux/usb/cdc.h | 16 | ||||
-rw-r--r-- | include/linux/usb/g_printer.h | 31 | ||||
-rw-r--r-- | include/linux/usb/gadget.h | 123 | ||||
-rw-r--r-- | include/linux/usb/gadgetfs.h | 27 | ||||
-rw-r--r-- | include/linux/usb/iowarrior.h | 25 | ||||
-rw-r--r-- | include/linux/usb/isp116x.h | 2 | ||||
-rw-r--r-- | include/linux/usb/midi.h | 26 | ||||
-rw-r--r-- | include/linux/usb/net2280.h | 32 | ||||
-rw-r--r-- | include/linux/usb/otg.h | 2 | ||||
-rw-r--r-- | include/linux/usb/serial.h | 160 | ||||
-rw-r--r-- | include/linux/usb/sl811.h | 6 | ||||
-rw-r--r-- | include/linux/usb_usual.h | 5 | ||||
-rw-r--r-- | include/linux/usbdevice_fs.h | 2 |
22 files changed, 700 insertions, 426 deletions
diff --git a/include/asm-arm/arch-at91/board.h b/include/asm-arm/arch-at91/board.h index 55b07bd5316c..dc189f01c5b3 100644 --- a/include/asm-arm/arch-at91/board.h +++ b/include/asm-arm/arch-at91/board.h | |||
@@ -40,7 +40,8 @@ | |||
40 | /* USB Device */ | 40 | /* USB Device */ |
41 | struct at91_udc_data { | 41 | struct at91_udc_data { |
42 | u8 vbus_pin; /* high == host powering us */ | 42 | u8 vbus_pin; /* high == host powering us */ |
43 | u8 pullup_pin; /* high == D+ pulled up */ | 43 | u8 pullup_pin; /* active == D+ pulled up */ |
44 | u8 pullup_active_low; /* true == pullup_pin is active low */ | ||
44 | }; | 45 | }; |
45 | extern void __init at91_add_device_udc(struct at91_udc_data *data); | 46 | extern void __init at91_add_device_udc(struct at91_udc_data *data); |
46 | 47 | ||
diff --git a/include/asm-arm/mach/udc_pxa2xx.h b/include/asm-arm/mach/udc_pxa2xx.h index ff0a95715a07..f191e147ea90 100644 --- a/include/asm-arm/mach/udc_pxa2xx.h +++ b/include/asm-arm/mach/udc_pxa2xx.h | |||
@@ -19,7 +19,9 @@ struct pxa2xx_udc_mach_info { | |||
19 | * with on-chip GPIOs not Lubbock's wierd hardware, can have a sane | 19 | * with on-chip GPIOs not Lubbock's wierd hardware, can have a sane |
20 | * VBUS IRQ and omit the methods above. Store the GPIO number | 20 | * VBUS IRQ and omit the methods above. Store the GPIO number |
21 | * here; for GPIO 0, also mask in one of the pxa_gpio_mode() bits. | 21 | * here; for GPIO 0, also mask in one of the pxa_gpio_mode() bits. |
22 | * Note that sometimes the signals go through inverters... | ||
22 | */ | 23 | */ |
24 | bool gpio_vbus_inverted; | ||
23 | u16 gpio_vbus; /* high == vbus present */ | 25 | u16 gpio_vbus; /* high == vbus present */ |
24 | u16 gpio_pullup; /* high == pullup activated */ | 26 | u16 gpio_pullup; /* high == pullup activated */ |
25 | }; | 27 | }; |
diff --git a/include/linux/aspm.h b/include/linux/aspm.h new file mode 100644 index 000000000000..f41a69895485 --- /dev/null +++ b/include/linux/aspm.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * aspm.h | ||
3 | * | ||
4 | * PCI Express ASPM defines and function prototypes | ||
5 | * | ||
6 | * Copyright (C) 2007 Intel Corp. | ||
7 | * Zhang Yanmin (yanmin.zhang@intel.com) | ||
8 | * Shaohua Li (shaohua.li@intel.com) | ||
9 | * | ||
10 | * For more information, please consult the following manuals (look at | ||
11 | * http://www.pcisig.com/ for how to get them): | ||
12 | * | ||
13 | * PCI Express Specification | ||
14 | */ | ||
15 | |||
16 | #ifndef LINUX_ASPM_H | ||
17 | #define LINUX_ASPM_H | ||
18 | |||
19 | #include <linux/pci.h> | ||
20 | |||
21 | #define PCIE_LINK_STATE_L0S 1 | ||
22 | #define PCIE_LINK_STATE_L1 2 | ||
23 | #define PCIE_LINK_STATE_CLKPM 4 | ||
24 | |||
25 | #ifdef CONFIG_PCIEASPM | ||
26 | extern void pcie_aspm_init_link_state(struct pci_dev *pdev); | ||
27 | extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); | ||
28 | extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); | ||
29 | extern void pci_disable_link_state(struct pci_dev *pdev, int state); | ||
30 | #else | ||
31 | #define pcie_aspm_init_link_state(pdev) do {} while (0) | ||
32 | #define pcie_aspm_exit_link_state(pdev) do {} while (0) | ||
33 | #define pcie_aspm_pm_state_change(pdev) do {} while (0) | ||
34 | #define pci_disable_link_state(pdev, state) do {} while (0) | ||
35 | #endif | ||
36 | |||
37 | #ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */ | ||
38 | extern void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev); | ||
39 | extern void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev); | ||
40 | #else | ||
41 | #define pcie_aspm_create_sysfs_dev_files(pdev) do {} while (0) | ||
42 | #define pcie_aspm_remove_sysfs_dev_files(pdev) do {} while (0) | ||
43 | #endif | ||
44 | #endif /* LINUX_ASPM_H */ | ||
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index 936ef82ed76a..3ba25065fa96 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h | |||
@@ -48,7 +48,15 @@ | |||
48 | 48 | ||
49 | #ifdef CONFIG_ACPI | 49 | #ifdef CONFIG_ACPI |
50 | extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags); | 50 | extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags); |
51 | extern acpi_status pci_osc_support_set(u32 flags); | 51 | extern acpi_status __pci_osc_support_set(u32 flags, const char *hid); |
52 | static inline acpi_status pci_osc_support_set(u32 flags) | ||
53 | { | ||
54 | return __pci_osc_support_set(flags, PCI_ROOT_HID_STRING); | ||
55 | } | ||
56 | static inline acpi_status pcie_osc_support_set(u32 flags) | ||
57 | { | ||
58 | return __pci_osc_support_set(flags, PCI_EXPRESS_ROOT_HID_STRING); | ||
59 | } | ||
52 | #else | 60 | #else |
53 | #if !defined(AE_ERROR) | 61 | #if !defined(AE_ERROR) |
54 | typedef u32 acpi_status; | 62 | typedef u32 acpi_status; |
@@ -57,6 +65,7 @@ typedef u32 acpi_status; | |||
57 | static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags) | 65 | static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags) |
58 | {return AE_ERROR;} | 66 | {return AE_ERROR;} |
59 | static inline acpi_status pci_osc_support_set(u32 flags) {return AE_ERROR;} | 67 | static inline acpi_status pci_osc_support_set(u32 flags) {return AE_ERROR;} |
68 | static inline acpi_status pcie_osc_support_set(u32 flags) {return AE_ERROR;} | ||
60 | #endif | 69 | #endif |
61 | 70 | ||
62 | #endif /* _PCI_ACPI_H_ */ | 71 | #endif /* _PCI_ACPI_H_ */ |
diff --git a/include/linux/pci.h b/include/linux/pci.h index ae1006322f80..4f96f1d94ac4 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -28,7 +28,7 @@ | |||
28 | * 7:3 = slot | 28 | * 7:3 = slot |
29 | * 2:0 = function | 29 | * 2:0 = function |
30 | */ | 30 | */ |
31 | #define PCI_DEVFN(slot,func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) | 31 | #define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) |
32 | #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) | 32 | #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) |
33 | #define PCI_FUNC(devfn) ((devfn) & 0x07) | 33 | #define PCI_FUNC(devfn) ((devfn) & 0x07) |
34 | 34 | ||
@@ -66,7 +66,6 @@ enum pci_mmap_state { | |||
66 | #define PCI_DMA_FROMDEVICE 2 | 66 | #define PCI_DMA_FROMDEVICE 2 |
67 | #define PCI_DMA_NONE 3 | 67 | #define PCI_DMA_NONE 3 |
68 | 68 | ||
69 | #define DEVICE_COUNT_COMPATIBLE 4 | ||
70 | #define DEVICE_COUNT_RESOURCE 12 | 69 | #define DEVICE_COUNT_RESOURCE 12 |
71 | 70 | ||
72 | typedef int __bitwise pci_power_t; | 71 | typedef int __bitwise pci_power_t; |
@@ -129,6 +128,7 @@ struct pci_cap_saved_state { | |||
129 | u32 data[0]; | 128 | u32 data[0]; |
130 | }; | 129 | }; |
131 | 130 | ||
131 | struct pcie_link_state; | ||
132 | /* | 132 | /* |
133 | * The pci_dev structure is used to describe PCI devices. | 133 | * The pci_dev structure is used to describe PCI devices. |
134 | */ | 134 | */ |
@@ -164,13 +164,13 @@ struct pci_dev { | |||
164 | this is D0-D3, D0 being fully functional, | 164 | this is D0-D3, D0 being fully functional, |
165 | and D3 being off. */ | 165 | and D3 being off. */ |
166 | 166 | ||
167 | #ifdef CONFIG_PCIEASPM | ||
168 | struct pcie_link_state *link_state; /* ASPM link state. */ | ||
169 | #endif | ||
170 | |||
167 | pci_channel_state_t error_state; /* current connectivity state */ | 171 | pci_channel_state_t error_state; /* current connectivity state */ |
168 | struct device dev; /* Generic device interface */ | 172 | struct device dev; /* Generic device interface */ |
169 | 173 | ||
170 | /* device is compatible with these IDs */ | ||
171 | unsigned short vendor_compatible[DEVICE_COUNT_COMPATIBLE]; | ||
172 | unsigned short device_compatible[DEVICE_COUNT_COMPATIBLE]; | ||
173 | |||
174 | int cfg_size; /* Size of configuration space */ | 174 | int cfg_size; /* Size of configuration space */ |
175 | 175 | ||
176 | /* | 176 | /* |
@@ -219,7 +219,7 @@ static inline int pci_channel_offline(struct pci_dev *pdev) | |||
219 | } | 219 | } |
220 | 220 | ||
221 | static inline struct pci_cap_saved_state *pci_find_saved_cap( | 221 | static inline struct pci_cap_saved_state *pci_find_saved_cap( |
222 | struct pci_dev *pci_dev,char cap) | 222 | struct pci_dev *pci_dev, char cap) |
223 | { | 223 | { |
224 | struct pci_cap_saved_state *tmp; | 224 | struct pci_cap_saved_state *tmp; |
225 | struct hlist_node *pos; | 225 | struct hlist_node *pos; |
@@ -278,13 +278,13 @@ struct pci_bus { | |||
278 | unsigned short bridge_ctl; /* manage NO_ISA/FBB/et al behaviors */ | 278 | unsigned short bridge_ctl; /* manage NO_ISA/FBB/et al behaviors */ |
279 | pci_bus_flags_t bus_flags; /* Inherited by child busses */ | 279 | pci_bus_flags_t bus_flags; /* Inherited by child busses */ |
280 | struct device *bridge; | 280 | struct device *bridge; |
281 | struct class_device class_dev; | 281 | struct device dev; |
282 | struct bin_attribute *legacy_io; /* legacy I/O for this bus */ | 282 | struct bin_attribute *legacy_io; /* legacy I/O for this bus */ |
283 | struct bin_attribute *legacy_mem; /* legacy mem */ | 283 | struct bin_attribute *legacy_mem; /* legacy mem */ |
284 | }; | 284 | }; |
285 | 285 | ||
286 | #define pci_bus_b(n) list_entry(n, struct pci_bus, node) | 286 | #define pci_bus_b(n) list_entry(n, struct pci_bus, node) |
287 | #define to_pci_bus(n) container_of(n, struct pci_bus, class_dev) | 287 | #define to_pci_bus(n) container_of(n, struct pci_bus, dev) |
288 | 288 | ||
289 | /* | 289 | /* |
290 | * Error values that may be returned by PCI functions. | 290 | * Error values that may be returned by PCI functions. |
@@ -314,8 +314,8 @@ struct pci_raw_ops { | |||
314 | extern struct pci_raw_ops *raw_pci_ops; | 314 | extern struct pci_raw_ops *raw_pci_ops; |
315 | 315 | ||
316 | struct pci_bus_region { | 316 | struct pci_bus_region { |
317 | unsigned long start; | 317 | resource_size_t start; |
318 | unsigned long end; | 318 | resource_size_t end; |
319 | }; | 319 | }; |
320 | 320 | ||
321 | struct pci_dynids { | 321 | struct pci_dynids { |
@@ -351,11 +351,10 @@ enum pci_ers_result { | |||
351 | }; | 351 | }; |
352 | 352 | ||
353 | /* PCI bus error event callbacks */ | 353 | /* PCI bus error event callbacks */ |
354 | struct pci_error_handlers | 354 | struct pci_error_handlers { |
355 | { | ||
356 | /* PCI bus error detected on this device */ | 355 | /* PCI bus error detected on this device */ |
357 | pci_ers_result_t (*error_detected)(struct pci_dev *dev, | 356 | pci_ers_result_t (*error_detected)(struct pci_dev *dev, |
358 | enum pci_channel_state error); | 357 | enum pci_channel_state error); |
359 | 358 | ||
360 | /* MMIO has been re-enabled, but not DMA */ | 359 | /* MMIO has been re-enabled, but not DMA */ |
361 | pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev); | 360 | pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev); |
@@ -390,7 +389,7 @@ struct pci_driver { | |||
390 | struct pci_dynids dynids; | 389 | struct pci_dynids dynids; |
391 | }; | 390 | }; |
392 | 391 | ||
393 | #define to_pci_driver(drv) container_of(drv,struct pci_driver, driver) | 392 | #define to_pci_driver(drv) container_of(drv, struct pci_driver, driver) |
394 | 393 | ||
395 | /** | 394 | /** |
396 | * PCI_DEVICE - macro used to describe a specific pci device | 395 | * PCI_DEVICE - macro used to describe a specific pci device |
@@ -448,7 +447,7 @@ extern int no_pci_devices(void); | |||
448 | 447 | ||
449 | void pcibios_fixup_bus(struct pci_bus *); | 448 | void pcibios_fixup_bus(struct pci_bus *); |
450 | int __must_check pcibios_enable_device(struct pci_dev *, int mask); | 449 | int __must_check pcibios_enable_device(struct pci_dev *, int mask); |
451 | char *pcibios_setup (char *str); | 450 | char *pcibios_setup(char *str); |
452 | 451 | ||
453 | /* Used only when drivers/pci/setup.c is used */ | 452 | /* Used only when drivers/pci/setup.c is used */ |
454 | void pcibios_align_resource(void *, struct resource *, resource_size_t, | 453 | void pcibios_align_resource(void *, struct resource *, resource_size_t, |
@@ -459,8 +458,10 @@ void pcibios_update_irq(struct pci_dev *, int irq); | |||
459 | 458 | ||
460 | extern struct pci_bus *pci_find_bus(int domain, int busnr); | 459 | extern struct pci_bus *pci_find_bus(int domain, int busnr); |
461 | void pci_bus_add_devices(struct pci_bus *bus); | 460 | void pci_bus_add_devices(struct pci_bus *bus); |
462 | struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata); | 461 | struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, |
463 | static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata) | 462 | struct pci_ops *ops, void *sysdata); |
463 | static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, | ||
464 | void *sysdata) | ||
464 | { | 465 | { |
465 | struct pci_bus *root_bus; | 466 | struct pci_bus *root_bus; |
466 | root_bus = pci_scan_bus_parented(NULL, bus, ops, sysdata); | 467 | root_bus = pci_scan_bus_parented(NULL, bus, ops, sysdata); |
@@ -468,15 +469,18 @@ static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *s | |||
468 | pci_bus_add_devices(root_bus); | 469 | pci_bus_add_devices(root_bus); |
469 | return root_bus; | 470 | return root_bus; |
470 | } | 471 | } |
471 | struct pci_bus *pci_create_bus(struct device *parent, int bus, struct pci_ops *ops, void *sysdata); | 472 | struct pci_bus *pci_create_bus(struct device *parent, int bus, |
472 | struct pci_bus * pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr); | 473 | struct pci_ops *ops, void *sysdata); |
474 | struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, | ||
475 | int busnr); | ||
473 | int pci_scan_slot(struct pci_bus *bus, int devfn); | 476 | int pci_scan_slot(struct pci_bus *bus, int devfn); |
474 | struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); | 477 | struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); |
475 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); | 478 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); |
476 | unsigned int pci_scan_child_bus(struct pci_bus *bus); | 479 | unsigned int pci_scan_child_bus(struct pci_bus *bus); |
477 | int __must_check pci_bus_add_device(struct pci_dev *dev); | 480 | int __must_check pci_bus_add_device(struct pci_dev *dev); |
478 | void pci_read_bridge_bases(struct pci_bus *child); | 481 | void pci_read_bridge_bases(struct pci_bus *child); |
479 | struct resource *pci_find_parent_resource(const struct pci_dev *dev, struct resource *res); | 482 | struct resource *pci_find_parent_resource(const struct pci_dev *dev, |
483 | struct resource *res); | ||
480 | int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); | 484 | int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); |
481 | extern struct pci_dev *pci_dev_get(struct pci_dev *dev); | 485 | extern struct pci_dev *pci_dev_get(struct pci_dev *dev); |
482 | extern void pci_dev_put(struct pci_dev *dev); | 486 | extern void pci_dev_put(struct pci_dev *dev); |
@@ -489,15 +493,19 @@ extern void pci_sort_breadthfirst(void); | |||
489 | /* Generic PCI functions exported to card drivers */ | 493 | /* Generic PCI functions exported to card drivers */ |
490 | 494 | ||
491 | #ifdef CONFIG_PCI_LEGACY | 495 | #ifdef CONFIG_PCI_LEGACY |
492 | struct pci_dev __deprecated *pci_find_device (unsigned int vendor, unsigned int device, const struct pci_dev *from); | 496 | struct pci_dev __deprecated *pci_find_device(unsigned int vendor, |
493 | struct pci_dev __deprecated *pci_find_slot (unsigned int bus, unsigned int devfn); | 497 | unsigned int device, |
498 | const struct pci_dev *from); | ||
499 | struct pci_dev __deprecated *pci_find_slot(unsigned int bus, | ||
500 | unsigned int devfn); | ||
494 | #endif /* CONFIG_PCI_LEGACY */ | 501 | #endif /* CONFIG_PCI_LEGACY */ |
495 | 502 | ||
496 | int pci_find_capability (struct pci_dev *dev, int cap); | 503 | int pci_find_capability(struct pci_dev *dev, int cap); |
497 | int pci_find_next_capability (struct pci_dev *dev, u8 pos, int cap); | 504 | int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); |
498 | int pci_find_ext_capability (struct pci_dev *dev, int cap); | 505 | int pci_find_ext_capability(struct pci_dev *dev, int cap); |
499 | int pci_find_ht_capability (struct pci_dev *dev, int ht_cap); | 506 | int pci_find_ht_capability(struct pci_dev *dev, int ht_cap); |
500 | int pci_find_next_ht_capability (struct pci_dev *dev, int pos, int ht_cap); | 507 | int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap); |
508 | void pcie_wait_pending_transaction(struct pci_dev *dev); | ||
501 | struct pci_bus *pci_find_next_bus(const struct pci_bus *from); | 509 | struct pci_bus *pci_find_next_bus(const struct pci_bus *from); |
502 | 510 | ||
503 | struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, | 511 | struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, |
@@ -505,49 +513,58 @@ struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, | |||
505 | struct pci_dev *pci_get_device_reverse(unsigned int vendor, unsigned int device, | 513 | struct pci_dev *pci_get_device_reverse(unsigned int vendor, unsigned int device, |
506 | struct pci_dev *from); | 514 | struct pci_dev *from); |
507 | 515 | ||
508 | struct pci_dev *pci_get_subsys (unsigned int vendor, unsigned int device, | 516 | struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, |
509 | unsigned int ss_vendor, unsigned int ss_device, | 517 | unsigned int ss_vendor, unsigned int ss_device, |
510 | struct pci_dev *from); | 518 | struct pci_dev *from); |
511 | struct pci_dev *pci_get_slot (struct pci_bus *bus, unsigned int devfn); | 519 | struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); |
512 | struct pci_dev *pci_get_bus_and_slot (unsigned int bus, unsigned int devfn); | 520 | struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); |
513 | struct pci_dev *pci_get_class (unsigned int class, struct pci_dev *from); | 521 | struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); |
514 | int pci_dev_present(const struct pci_device_id *ids); | 522 | int pci_dev_present(const struct pci_device_id *ids); |
515 | const struct pci_device_id *pci_find_present(const struct pci_device_id *ids); | 523 | const struct pci_device_id *pci_find_present(const struct pci_device_id *ids); |
516 | 524 | ||
517 | int pci_bus_read_config_byte (struct pci_bus *bus, unsigned int devfn, int where, u8 *val); | 525 | int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn, |
518 | int pci_bus_read_config_word (struct pci_bus *bus, unsigned int devfn, int where, u16 *val); | 526 | int where, u8 *val); |
519 | int pci_bus_read_config_dword (struct pci_bus *bus, unsigned int devfn, int where, u32 *val); | 527 | int pci_bus_read_config_word(struct pci_bus *bus, unsigned int devfn, |
520 | int pci_bus_write_config_byte (struct pci_bus *bus, unsigned int devfn, int where, u8 val); | 528 | int where, u16 *val); |
521 | int pci_bus_write_config_word (struct pci_bus *bus, unsigned int devfn, int where, u16 val); | 529 | int pci_bus_read_config_dword(struct pci_bus *bus, unsigned int devfn, |
522 | int pci_bus_write_config_dword (struct pci_bus *bus, unsigned int devfn, int where, u32 val); | 530 | int where, u32 *val); |
531 | int pci_bus_write_config_byte(struct pci_bus *bus, unsigned int devfn, | ||
532 | int where, u8 val); | ||
533 | int pci_bus_write_config_word(struct pci_bus *bus, unsigned int devfn, | ||
534 | int where, u16 val); | ||
535 | int pci_bus_write_config_dword(struct pci_bus *bus, unsigned int devfn, | ||
536 | int where, u32 val); | ||
523 | 537 | ||
524 | static inline int pci_read_config_byte(struct pci_dev *dev, int where, u8 *val) | 538 | static inline int pci_read_config_byte(struct pci_dev *dev, int where, u8 *val) |
525 | { | 539 | { |
526 | return pci_bus_read_config_byte (dev->bus, dev->devfn, where, val); | 540 | return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val); |
527 | } | 541 | } |
528 | static inline int pci_read_config_word(struct pci_dev *dev, int where, u16 *val) | 542 | static inline int pci_read_config_word(struct pci_dev *dev, int where, u16 *val) |
529 | { | 543 | { |
530 | return pci_bus_read_config_word (dev->bus, dev->devfn, where, val); | 544 | return pci_bus_read_config_word(dev->bus, dev->devfn, where, val); |
531 | } | 545 | } |
532 | static inline int pci_read_config_dword(struct pci_dev *dev, int where, u32 *val) | 546 | static inline int pci_read_config_dword(struct pci_dev *dev, int where, |
547 | u32 *val) | ||
533 | { | 548 | { |
534 | return pci_bus_read_config_dword (dev->bus, dev->devfn, where, val); | 549 | return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val); |
535 | } | 550 | } |
536 | static inline int pci_write_config_byte(struct pci_dev *dev, int where, u8 val) | 551 | static inline int pci_write_config_byte(struct pci_dev *dev, int where, u8 val) |
537 | { | 552 | { |
538 | return pci_bus_write_config_byte (dev->bus, dev->devfn, where, val); | 553 | return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val); |
539 | } | 554 | } |
540 | static inline int pci_write_config_word(struct pci_dev *dev, int where, u16 val) | 555 | static inline int pci_write_config_word(struct pci_dev *dev, int where, u16 val) |
541 | { | 556 | { |
542 | return pci_bus_write_config_word (dev->bus, dev->devfn, where, val); | 557 | return pci_bus_write_config_word(dev->bus, dev->devfn, where, val); |
543 | } | 558 | } |
544 | static inline int pci_write_config_dword(struct pci_dev *dev, int where, u32 val) | 559 | static inline int pci_write_config_dword(struct pci_dev *dev, int where, |
560 | u32 val) | ||
545 | { | 561 | { |
546 | return pci_bus_write_config_dword (dev->bus, dev->devfn, where, val); | 562 | return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); |
547 | } | 563 | } |
548 | 564 | ||
549 | int __must_check pci_enable_device(struct pci_dev *dev); | 565 | int __must_check pci_enable_device(struct pci_dev *dev); |
550 | int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask); | 566 | int __must_check pci_enable_device_io(struct pci_dev *dev); |
567 | int __must_check pci_enable_device_mem(struct pci_dev *dev); | ||
551 | int __must_check pci_reenable_device(struct pci_dev *); | 568 | int __must_check pci_reenable_device(struct pci_dev *); |
552 | int __must_check pcim_enable_device(struct pci_dev *pdev); | 569 | int __must_check pcim_enable_device(struct pci_dev *pdev); |
553 | void pcim_pin_device(struct pci_dev *pdev); | 570 | void pcim_pin_device(struct pci_dev *pdev); |
@@ -576,14 +593,11 @@ int pcie_set_readrq(struct pci_dev *dev, int rq); | |||
576 | void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); | 593 | void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); |
577 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); | 594 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); |
578 | int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i); | 595 | int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i); |
579 | void pci_restore_bars(struct pci_dev *dev); | ||
580 | int pci_select_bars(struct pci_dev *dev, unsigned long flags); | 596 | int pci_select_bars(struct pci_dev *dev, unsigned long flags); |
581 | 597 | ||
582 | /* ROM control related routines */ | 598 | /* ROM control related routines */ |
583 | void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); | 599 | void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); |
584 | void __iomem __must_check *pci_map_rom_copy(struct pci_dev *pdev, size_t *size); | ||
585 | void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); | 600 | void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); |
586 | void pci_remove_rom(struct pci_dev *pdev); | ||
587 | size_t pci_get_rom_size(void __iomem *rom, size_t size); | 601 | size_t pci_get_rom_size(void __iomem *rom, size_t size); |
588 | 602 | ||
589 | /* Power management related routines */ | 603 | /* Power management related routines */ |
@@ -594,7 +608,7 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); | |||
594 | int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); | 608 | int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); |
595 | 609 | ||
596 | /* Functions for PCI Hotplug drivers to use */ | 610 | /* Functions for PCI Hotplug drivers to use */ |
597 | int pci_bus_find_capability (struct pci_bus *bus, unsigned int devfn, int cap); | 611 | int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); |
598 | 612 | ||
599 | /* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ | 613 | /* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ |
600 | void pci_bus_assign_resources(struct pci_bus *bus); | 614 | void pci_bus_assign_resources(struct pci_bus *bus); |
@@ -631,16 +645,18 @@ static inline int __must_check pci_register_driver(struct pci_driver *driver) | |||
631 | return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME); | 645 | return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME); |
632 | } | 646 | } |
633 | 647 | ||
634 | void pci_unregister_driver(struct pci_driver *); | 648 | void pci_unregister_driver(struct pci_driver *dev); |
635 | void pci_remove_behind_bridge(struct pci_dev *); | 649 | void pci_remove_behind_bridge(struct pci_dev *dev); |
636 | struct pci_driver *pci_dev_driver(const struct pci_dev *); | 650 | struct pci_driver *pci_dev_driver(const struct pci_dev *dev); |
637 | const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, struct pci_dev *dev); | 651 | const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, |
638 | int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass); | 652 | struct pci_dev *dev); |
653 | int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, | ||
654 | int pass); | ||
639 | 655 | ||
640 | void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), | 656 | void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), |
641 | void *userdata); | 657 | void *userdata); |
642 | int pci_cfg_space_size(struct pci_dev *dev); | 658 | int pci_cfg_space_size(struct pci_dev *dev); |
643 | unsigned char pci_bus_max_busnr(struct pci_bus* bus); | 659 | unsigned char pci_bus_max_busnr(struct pci_bus *bus); |
644 | 660 | ||
645 | /* kmem_cache style wrapper around pci_alloc_consistent() */ | 661 | /* kmem_cache style wrapper around pci_alloc_consistent() */ |
646 | 662 | ||
@@ -669,19 +685,36 @@ struct msix_entry { | |||
669 | 685 | ||
670 | 686 | ||
671 | #ifndef CONFIG_PCI_MSI | 687 | #ifndef CONFIG_PCI_MSI |
672 | static inline int pci_enable_msi(struct pci_dev *dev) {return -1;} | 688 | static inline int pci_enable_msi(struct pci_dev *dev) |
673 | static inline void pci_disable_msi(struct pci_dev *dev) {} | 689 | { |
674 | static inline int pci_enable_msix(struct pci_dev* dev, | 690 | return -1; |
675 | struct msix_entry *entries, int nvec) {return -1;} | 691 | } |
676 | static inline void pci_disable_msix(struct pci_dev *dev) {} | 692 | |
677 | static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) {} | 693 | static inline void pci_disable_msi(struct pci_dev *dev) |
694 | { } | ||
695 | |||
696 | static inline int pci_enable_msix(struct pci_dev *dev, | ||
697 | struct msix_entry *entries, int nvec) | ||
698 | { | ||
699 | return -1; | ||
700 | } | ||
701 | |||
702 | static inline void pci_disable_msix(struct pci_dev *dev) | ||
703 | { } | ||
704 | |||
705 | static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) | ||
706 | { } | ||
707 | |||
708 | static inline void pci_restore_msi_state(struct pci_dev *dev) | ||
709 | { } | ||
678 | #else | 710 | #else |
679 | extern int pci_enable_msi(struct pci_dev *dev); | 711 | extern int pci_enable_msi(struct pci_dev *dev); |
680 | extern void pci_disable_msi(struct pci_dev *dev); | 712 | extern void pci_disable_msi(struct pci_dev *dev); |
681 | extern int pci_enable_msix(struct pci_dev* dev, | 713 | extern int pci_enable_msix(struct pci_dev *dev, |
682 | struct msix_entry *entries, int nvec); | 714 | struct msix_entry *entries, int nvec); |
683 | extern void pci_disable_msix(struct pci_dev *dev); | 715 | extern void pci_disable_msix(struct pci_dev *dev); |
684 | extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); | 716 | extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); |
717 | extern void pci_restore_msi_state(struct pci_dev *dev); | ||
685 | #endif | 718 | #endif |
686 | 719 | ||
687 | #ifdef CONFIG_HT_IRQ | 720 | #ifdef CONFIG_HT_IRQ |
@@ -702,7 +735,11 @@ extern void pci_unblock_user_cfg_access(struct pci_dev *dev); | |||
702 | extern int pci_domains_supported; | 735 | extern int pci_domains_supported; |
703 | #else | 736 | #else |
704 | enum { pci_domains_supported = 0 }; | 737 | enum { pci_domains_supported = 0 }; |
705 | static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } | 738 | static inline int pci_domain_nr(struct pci_bus *bus) |
739 | { | ||
740 | return 0; | ||
741 | } | ||
742 | |||
706 | static inline int pci_proc_domain(struct pci_bus *bus) | 743 | static inline int pci_proc_domain(struct pci_bus *bus) |
707 | { | 744 | { |
708 | return 0; | 745 | return 0; |
@@ -716,67 +753,161 @@ static inline int pci_proc_domain(struct pci_bus *bus) | |||
716 | * these as simple inline functions to avoid hair in drivers. | 753 | * these as simple inline functions to avoid hair in drivers. |
717 | */ | 754 | */ |
718 | 755 | ||
719 | #define _PCI_NOP(o,s,t) \ | 756 | #define _PCI_NOP(o, s, t) \ |
720 | static inline int pci_##o##_config_##s (struct pci_dev *dev, int where, t val) \ | 757 | static inline int pci_##o##_config_##s(struct pci_dev *dev, \ |
758 | int where, t val) \ | ||
721 | { return PCIBIOS_FUNC_NOT_SUPPORTED; } | 759 | { return PCIBIOS_FUNC_NOT_SUPPORTED; } |
722 | #define _PCI_NOP_ALL(o,x) _PCI_NOP(o,byte,u8 x) \ | 760 | |
723 | _PCI_NOP(o,word,u16 x) \ | 761 | #define _PCI_NOP_ALL(o, x) _PCI_NOP(o, byte, u8 x) \ |
724 | _PCI_NOP(o,dword,u32 x) | 762 | _PCI_NOP(o, word, u16 x) \ |
763 | _PCI_NOP(o, dword, u32 x) | ||
725 | _PCI_NOP_ALL(read, *) | 764 | _PCI_NOP_ALL(read, *) |
726 | _PCI_NOP_ALL(write,) | 765 | _PCI_NOP_ALL(write,) |
727 | 766 | ||
728 | static inline struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device, const struct pci_dev *from) | 767 | static inline struct pci_dev *pci_find_device(unsigned int vendor, |
729 | { return NULL; } | 768 | unsigned int device, |
769 | const struct pci_dev *from) | ||
770 | { | ||
771 | return NULL; | ||
772 | } | ||
730 | 773 | ||
731 | static inline struct pci_dev *pci_find_slot(unsigned int bus, unsigned int devfn) | 774 | static inline struct pci_dev *pci_find_slot(unsigned int bus, |
732 | { return NULL; } | 775 | unsigned int devfn) |
776 | { | ||
777 | return NULL; | ||
778 | } | ||
733 | 779 | ||
734 | static inline struct pci_dev *pci_get_device(unsigned int vendor, | 780 | static inline struct pci_dev *pci_get_device(unsigned int vendor, |
735 | unsigned int device, struct pci_dev *from) | 781 | unsigned int device, |
736 | { return NULL; } | 782 | struct pci_dev *from) |
783 | { | ||
784 | return NULL; | ||
785 | } | ||
737 | 786 | ||
738 | static inline struct pci_dev *pci_get_device_reverse(unsigned int vendor, | 787 | static inline struct pci_dev *pci_get_device_reverse(unsigned int vendor, |
739 | unsigned int device, struct pci_dev *from) | 788 | unsigned int device, |
740 | { return NULL; } | 789 | struct pci_dev *from) |
790 | { | ||
791 | return NULL; | ||
792 | } | ||
741 | 793 | ||
742 | static inline struct pci_dev *pci_get_subsys (unsigned int vendor, unsigned int device, | 794 | static inline struct pci_dev *pci_get_subsys(unsigned int vendor, |
743 | unsigned int ss_vendor, unsigned int ss_device, struct pci_dev *from) | 795 | unsigned int device, |
744 | { return NULL; } | 796 | unsigned int ss_vendor, |
797 | unsigned int ss_device, | ||
798 | struct pci_dev *from) | ||
799 | { | ||
800 | return NULL; | ||
801 | } | ||
745 | 802 | ||
746 | static inline struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from) | 803 | static inline struct pci_dev *pci_get_class(unsigned int class, |
747 | { return NULL; } | 804 | struct pci_dev *from) |
805 | { | ||
806 | return NULL; | ||
807 | } | ||
748 | 808 | ||
749 | #define pci_dev_present(ids) (0) | 809 | #define pci_dev_present(ids) (0) |
750 | #define no_pci_devices() (1) | 810 | #define no_pci_devices() (1) |
751 | #define pci_find_present(ids) (NULL) | 811 | #define pci_find_present(ids) (NULL) |
752 | #define pci_dev_put(dev) do { } while (0) | 812 | #define pci_dev_put(dev) do { } while (0) |
753 | 813 | ||
754 | static inline void pci_set_master(struct pci_dev *dev) { } | 814 | static inline void pci_set_master(struct pci_dev *dev) |
755 | static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; } | 815 | { } |
756 | static inline void pci_disable_device(struct pci_dev *dev) { } | 816 | |
757 | static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask) { return -EIO; } | 817 | static inline int pci_enable_device(struct pci_dev *dev) |
758 | static inline int pci_assign_resource(struct pci_dev *dev, int i) { return -EBUSY;} | 818 | { |
759 | static inline int __pci_register_driver(struct pci_driver *drv, struct module *owner) { return 0;} | 819 | return -EIO; |
760 | static inline int pci_register_driver(struct pci_driver *drv) { return 0;} | 820 | } |
761 | static inline void pci_unregister_driver(struct pci_driver *drv) { } | 821 | |
762 | static inline int pci_find_capability (struct pci_dev *dev, int cap) {return 0; } | 822 | static inline void pci_disable_device(struct pci_dev *dev) |
763 | static inline int pci_find_next_capability (struct pci_dev *dev, u8 post, int cap) { return 0; } | 823 | { } |
764 | static inline int pci_find_ext_capability (struct pci_dev *dev, int cap) {return 0; } | 824 | |
825 | static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask) | ||
826 | { | ||
827 | return -EIO; | ||
828 | } | ||
829 | |||
830 | static inline int pci_assign_resource(struct pci_dev *dev, int i) | ||
831 | { | ||
832 | return -EBUSY; | ||
833 | } | ||
834 | |||
835 | static inline int __pci_register_driver(struct pci_driver *drv, | ||
836 | struct module *owner) | ||
837 | { | ||
838 | return 0; | ||
839 | } | ||
840 | |||
841 | static inline int pci_register_driver(struct pci_driver *drv) | ||
842 | { | ||
843 | return 0; | ||
844 | } | ||
845 | |||
846 | static inline void pci_unregister_driver(struct pci_driver *drv) | ||
847 | { } | ||
848 | |||
849 | static inline int pci_find_capability(struct pci_dev *dev, int cap) | ||
850 | { | ||
851 | return 0; | ||
852 | } | ||
853 | |||
854 | static inline int pci_find_next_capability(struct pci_dev *dev, u8 post, | ||
855 | int cap) | ||
856 | { | ||
857 | return 0; | ||
858 | } | ||
859 | |||
860 | static inline int pci_find_ext_capability(struct pci_dev *dev, int cap) | ||
861 | { | ||
862 | return 0; | ||
863 | } | ||
864 | |||
865 | static inline void pcie_wait_pending_transaction(struct pci_dev *dev) | ||
866 | { } | ||
765 | 867 | ||
766 | /* Power management related routines */ | 868 | /* Power management related routines */ |
767 | static inline int pci_save_state(struct pci_dev *dev) { return 0; } | 869 | static inline int pci_save_state(struct pci_dev *dev) |
768 | static inline int pci_restore_state(struct pci_dev *dev) { return 0; } | 870 | { |
769 | static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state) { return 0; } | 871 | return 0; |
770 | static inline pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) { return PCI_D0; } | 872 | } |
771 | static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable) { return 0; } | 873 | |
874 | static inline int pci_restore_state(struct pci_dev *dev) | ||
875 | { | ||
876 | return 0; | ||
877 | } | ||
878 | |||
879 | static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state) | ||
880 | { | ||
881 | return 0; | ||
882 | } | ||
883 | |||
884 | static inline pci_power_t pci_choose_state(struct pci_dev *dev, | ||
885 | pm_message_t state) | ||
886 | { | ||
887 | return PCI_D0; | ||
888 | } | ||
889 | |||
890 | static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, | ||
891 | int enable) | ||
892 | { | ||
893 | return 0; | ||
894 | } | ||
895 | |||
896 | static inline int pci_request_regions(struct pci_dev *dev, const char *res_name) | ||
897 | { | ||
898 | return -EIO; | ||
899 | } | ||
772 | 900 | ||
773 | static inline int pci_request_regions(struct pci_dev *dev, const char *res_name) { return -EIO; } | 901 | static inline void pci_release_regions(struct pci_dev *dev) |
774 | static inline void pci_release_regions(struct pci_dev *dev) { } | 902 | { } |
775 | 903 | ||
776 | #define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) | 904 | #define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) |
777 | 905 | ||
778 | static inline void pci_block_user_cfg_access(struct pci_dev *dev) { } | 906 | static inline void pci_block_user_cfg_access(struct pci_dev *dev) |
779 | static inline void pci_unblock_user_cfg_access(struct pci_dev *dev) { } | 907 | { } |
908 | |||
909 | static inline void pci_unblock_user_cfg_access(struct pci_dev *dev) | ||
910 | { } | ||
780 | 911 | ||
781 | static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from) | 912 | static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from) |
782 | { return NULL; } | 913 | { return NULL; } |
@@ -797,27 +928,27 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus, | |||
797 | 928 | ||
798 | /* these helpers provide future and backwards compatibility | 929 | /* these helpers provide future and backwards compatibility |
799 | * for accessing popular PCI BAR info */ | 930 | * for accessing popular PCI BAR info */ |
800 | #define pci_resource_start(dev,bar) ((dev)->resource[(bar)].start) | 931 | #define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start) |
801 | #define pci_resource_end(dev,bar) ((dev)->resource[(bar)].end) | 932 | #define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end) |
802 | #define pci_resource_flags(dev,bar) ((dev)->resource[(bar)].flags) | 933 | #define pci_resource_flags(dev, bar) ((dev)->resource[(bar)].flags) |
803 | #define pci_resource_len(dev,bar) \ | 934 | #define pci_resource_len(dev,bar) \ |
804 | ((pci_resource_start((dev),(bar)) == 0 && \ | 935 | ((pci_resource_start((dev), (bar)) == 0 && \ |
805 | pci_resource_end((dev),(bar)) == \ | 936 | pci_resource_end((dev), (bar)) == \ |
806 | pci_resource_start((dev),(bar))) ? 0 : \ | 937 | pci_resource_start((dev), (bar))) ? 0 : \ |
807 | \ | 938 | \ |
808 | (pci_resource_end((dev),(bar)) - \ | 939 | (pci_resource_end((dev), (bar)) - \ |
809 | pci_resource_start((dev),(bar)) + 1)) | 940 | pci_resource_start((dev), (bar)) + 1)) |
810 | 941 | ||
811 | /* Similar to the helpers above, these manipulate per-pci_dev | 942 | /* Similar to the helpers above, these manipulate per-pci_dev |
812 | * driver-specific data. They are really just a wrapper around | 943 | * driver-specific data. They are really just a wrapper around |
813 | * the generic device structure functions of these calls. | 944 | * the generic device structure functions of these calls. |
814 | */ | 945 | */ |
815 | static inline void *pci_get_drvdata (struct pci_dev *pdev) | 946 | static inline void *pci_get_drvdata(struct pci_dev *pdev) |
816 | { | 947 | { |
817 | return dev_get_drvdata(&pdev->dev); | 948 | return dev_get_drvdata(&pdev->dev); |
818 | } | 949 | } |
819 | 950 | ||
820 | static inline void pci_set_drvdata (struct pci_dev *pdev, void *data) | 951 | static inline void pci_set_drvdata(struct pci_dev *pdev, void *data) |
821 | { | 952 | { |
822 | dev_set_drvdata(&pdev->dev, data); | 953 | dev_set_drvdata(&pdev->dev, data); |
823 | } | 954 | } |
@@ -836,7 +967,7 @@ static inline char *pci_name(struct pci_dev *pdev) | |||
836 | */ | 967 | */ |
837 | #ifndef HAVE_ARCH_PCI_RESOURCE_TO_USER | 968 | #ifndef HAVE_ARCH_PCI_RESOURCE_TO_USER |
838 | static inline void pci_resource_to_user(const struct pci_dev *dev, int bar, | 969 | static inline void pci_resource_to_user(const struct pci_dev *dev, int bar, |
839 | const struct resource *rsrc, resource_size_t *start, | 970 | const struct resource *rsrc, resource_size_t *start, |
840 | resource_size_t *end) | 971 | resource_size_t *end) |
841 | { | 972 | { |
842 | *start = rsrc->start; | 973 | *start = rsrc->start; |
@@ -888,9 +1019,9 @@ enum pci_fixup_pass { | |||
888 | 1019 | ||
889 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); | 1020 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); |
890 | 1021 | ||
891 | void __iomem * pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); | 1022 | void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); |
892 | void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr); | 1023 | void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr); |
893 | void __iomem * const * pcim_iomap_table(struct pci_dev *pdev); | 1024 | void __iomem * const *pcim_iomap_table(struct pci_dev *pdev); |
894 | int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name); | 1025 | int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name); |
895 | void pcim_iounmap_regions(struct pci_dev *pdev, u16 mask); | 1026 | void pcim_iounmap_regions(struct pci_dev *pdev, u16 mask); |
896 | 1027 | ||
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h index c1914a8b94a9..c0c1223c9194 100644 --- a/include/linux/pci_regs.h +++ b/include/linux/pci_regs.h | |||
@@ -395,9 +395,17 @@ | |||
395 | #define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ | 395 | #define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ |
396 | #define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ | 396 | #define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ |
397 | #define PCI_EXP_LNKCAP 12 /* Link Capabilities */ | 397 | #define PCI_EXP_LNKCAP 12 /* Link Capabilities */ |
398 | #define PCI_EXP_LNKCAP_ASPMS 0xc00 /* ASPM Support */ | ||
399 | #define PCI_EXP_LNKCAP_L0SEL 0x7000 /* L0s Exit Latency */ | ||
400 | #define PCI_EXP_LNKCAP_L1EL 0x38000 /* L1 Exit Latency */ | ||
401 | #define PCI_EXP_LNKCAP_CLKPM 0x40000 /* L1 Clock Power Management */ | ||
398 | #define PCI_EXP_LNKCTL 16 /* Link Control */ | 402 | #define PCI_EXP_LNKCTL 16 /* Link Control */ |
403 | #define PCI_EXP_LNKCTL_RL 0x20 /* Retrain Link */ | ||
404 | #define PCI_EXP_LNKCTL_CCC 0x40 /* Common Clock COnfiguration */ | ||
399 | #define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */ | 405 | #define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */ |
400 | #define PCI_EXP_LNKSTA 18 /* Link Status */ | 406 | #define PCI_EXP_LNKSTA 18 /* Link Status */ |
407 | #define PCI_EXP_LNKSTA_LT 0x800 /* Link Training */ | ||
408 | #define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */ | ||
401 | #define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ | 409 | #define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ |
402 | #define PCI_EXP_SLTCTL 24 /* Slot Control */ | 410 | #define PCI_EXP_SLTCTL 24 /* Slot Control */ |
403 | #define PCI_EXP_SLTSTA 26 /* Slot Status */ | 411 | #define PCI_EXP_SLTSTA 26 /* Slot Status */ |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 5fc8ff73b7bb..2372e2e6b527 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -162,19 +162,19 @@ struct usb_interface { | |||
162 | unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ | 162 | unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ |
163 | 163 | ||
164 | struct device dev; /* interface specific device info */ | 164 | struct device dev; /* interface specific device info */ |
165 | struct device *usb_dev; /* pointer to the usb class's device, if any */ | 165 | struct device *usb_dev; |
166 | int pm_usage_cnt; /* usage counter for autosuspend */ | 166 | int pm_usage_cnt; /* usage counter for autosuspend */ |
167 | }; | 167 | }; |
168 | #define to_usb_interface(d) container_of(d, struct usb_interface, dev) | 168 | #define to_usb_interface(d) container_of(d, struct usb_interface, dev) |
169 | #define interface_to_usbdev(intf) \ | 169 | #define interface_to_usbdev(intf) \ |
170 | container_of(intf->dev.parent, struct usb_device, dev) | 170 | container_of(intf->dev.parent, struct usb_device, dev) |
171 | 171 | ||
172 | static inline void *usb_get_intfdata (struct usb_interface *intf) | 172 | static inline void *usb_get_intfdata(struct usb_interface *intf) |
173 | { | 173 | { |
174 | return dev_get_drvdata (&intf->dev); | 174 | return dev_get_drvdata(&intf->dev); |
175 | } | 175 | } |
176 | 176 | ||
177 | static inline void usb_set_intfdata (struct usb_interface *intf, void *data) | 177 | static inline void usb_set_intfdata(struct usb_interface *intf, void *data) |
178 | { | 178 | { |
179 | dev_set_drvdata(&intf->dev, data); | 179 | dev_set_drvdata(&intf->dev, data); |
180 | } | 180 | } |
@@ -275,9 +275,10 @@ struct usb_host_config { | |||
275 | 275 | ||
276 | int __usb_get_extra_descriptor(char *buffer, unsigned size, | 276 | int __usb_get_extra_descriptor(char *buffer, unsigned size, |
277 | unsigned char type, void **ptr); | 277 | unsigned char type, void **ptr); |
278 | #define usb_get_extra_descriptor(ifpoint,type,ptr)\ | 278 | #define usb_get_extra_descriptor(ifpoint, type, ptr) \ |
279 | __usb_get_extra_descriptor((ifpoint)->extra,(ifpoint)->extralen,\ | 279 | __usb_get_extra_descriptor((ifpoint)->extra, \ |
280 | type,(void**)ptr) | 280 | (ifpoint)->extralen, \ |
281 | type, (void **)ptr) | ||
281 | 282 | ||
282 | /* ----------------------------------------------------------------------- */ | 283 | /* ----------------------------------------------------------------------- */ |
283 | 284 | ||
@@ -318,7 +319,7 @@ struct usb_bus { | |||
318 | #ifdef CONFIG_USB_DEVICEFS | 319 | #ifdef CONFIG_USB_DEVICEFS |
319 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ | 320 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ |
320 | #endif | 321 | #endif |
321 | struct class_device *class_dev; /* class device for this bus */ | 322 | struct device *dev; /* device for this bus */ |
322 | 323 | ||
323 | #if defined(CONFIG_USB_MON) | 324 | #if defined(CONFIG_USB_MON) |
324 | struct mon_bus *mon_bus; /* non-null when associated */ | 325 | struct mon_bus *mon_bus; /* non-null when associated */ |
@@ -388,7 +389,7 @@ struct usb_device { | |||
388 | unsigned can_submit:1; /* URBs may be submitted */ | 389 | unsigned can_submit:1; /* URBs may be submitted */ |
389 | unsigned discon_suspended:1; /* Disconnected while suspended */ | 390 | unsigned discon_suspended:1; /* Disconnected while suspended */ |
390 | unsigned have_langid:1; /* whether string_langid is valid */ | 391 | unsigned have_langid:1; /* whether string_langid is valid */ |
391 | unsigned authorized:1; /* Policy has determined we can use it */ | 392 | unsigned authorized:1; /* Policy has said we can use it */ |
392 | unsigned wusb:1; /* Device is Wireless USB */ | 393 | unsigned wusb:1; /* Device is Wireless USB */ |
393 | int string_langid; /* language ID for strings */ | 394 | int string_langid; /* language ID for strings */ |
394 | 395 | ||
@@ -417,7 +418,10 @@ struct usb_device { | |||
417 | 418 | ||
418 | int pm_usage_cnt; /* usage counter for autosuspend */ | 419 | int pm_usage_cnt; /* usage counter for autosuspend */ |
419 | u32 quirks; /* quirks of the whole device */ | 420 | u32 quirks; /* quirks of the whole device */ |
420 | atomic_t urbnum; /* number of URBs submitted for the whole device */ | 421 | atomic_t urbnum; /* number of URBs submitted for |
422 | the whole device */ | ||
423 | |||
424 | unsigned long active_duration; /* total time device is not suspended */ | ||
421 | 425 | ||
422 | #ifdef CONFIG_PM | 426 | #ifdef CONFIG_PM |
423 | struct delayed_work autosuspend; /* for delayed autosuspends */ | 427 | struct delayed_work autosuspend; /* for delayed autosuspends */ |
@@ -425,6 +429,7 @@ struct usb_device { | |||
425 | 429 | ||
426 | unsigned long last_busy; /* time of last use */ | 430 | unsigned long last_busy; /* time of last use */ |
427 | int autosuspend_delay; /* in jiffies */ | 431 | int autosuspend_delay; /* in jiffies */ |
432 | unsigned long connect_time; /* time device was first connected */ | ||
428 | 433 | ||
429 | unsigned auto_pm:1; /* autosuspend/resume in progress */ | 434 | unsigned auto_pm:1; /* autosuspend/resume in progress */ |
430 | unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */ | 435 | unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */ |
@@ -498,11 +503,11 @@ static inline void usb_mark_last_busy(struct usb_device *udev) | |||
498 | /*-------------------------------------------------------------------------*/ | 503 | /*-------------------------------------------------------------------------*/ |
499 | 504 | ||
500 | /* for drivers using iso endpoints */ | 505 | /* for drivers using iso endpoints */ |
501 | extern int usb_get_current_frame_number (struct usb_device *usb_dev); | 506 | extern int usb_get_current_frame_number(struct usb_device *usb_dev); |
502 | 507 | ||
503 | /* used these for multi-interface device registration */ | 508 | /* used these for multi-interface device registration */ |
504 | extern int usb_driver_claim_interface(struct usb_driver *driver, | 509 | extern int usb_driver_claim_interface(struct usb_driver *driver, |
505 | struct usb_interface *iface, void* priv); | 510 | struct usb_interface *iface, void *priv); |
506 | 511 | ||
507 | /** | 512 | /** |
508 | * usb_interface_claimed - returns true iff an interface is claimed | 513 | * usb_interface_claimed - returns true iff an interface is claimed |
@@ -514,7 +519,8 @@ extern int usb_driver_claim_interface(struct usb_driver *driver, | |||
514 | * may need to explicitly claim that lock. | 519 | * may need to explicitly claim that lock. |
515 | * | 520 | * |
516 | */ | 521 | */ |
517 | static inline int usb_interface_claimed(struct usb_interface *iface) { | 522 | static inline int usb_interface_claimed(struct usb_interface *iface) |
523 | { | ||
518 | return (iface->dev.driver != NULL); | 524 | return (iface->dev.driver != NULL); |
519 | } | 525 | } |
520 | 526 | ||
@@ -557,12 +563,11 @@ extern struct usb_host_interface *usb_altnum_to_altsetting( | |||
557 | * USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are | 563 | * USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are |
558 | * high speed, and a different one if they are full or low speed. | 564 | * high speed, and a different one if they are full or low speed. |
559 | */ | 565 | */ |
560 | static inline int usb_make_path (struct usb_device *dev, char *buf, | 566 | static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size) |
561 | size_t size) | ||
562 | { | 567 | { |
563 | int actual; | 568 | int actual; |
564 | actual = snprintf (buf, size, "usb-%s-%s", dev->bus->bus_name, | 569 | actual = snprintf(buf, size, "usb-%s-%s", dev->bus->bus_name, |
565 | dev->devpath); | 570 | dev->devpath); |
566 | return (actual >= (int)size) ? -1 : actual; | 571 | return (actual >= (int)size) ? -1 : actual; |
567 | } | 572 | } |
568 | 573 | ||
@@ -608,7 +613,8 @@ static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd) | |||
608 | * | 613 | * |
609 | * Returns true if the endpoint is of type OUT, otherwise it returns false. | 614 | * Returns true if the endpoint is of type OUT, otherwise it returns false. |
610 | */ | 615 | */ |
611 | static inline int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd) | 616 | static inline int usb_endpoint_dir_out( |
617 | const struct usb_endpoint_descriptor *epd) | ||
612 | { | 618 | { |
613 | return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT); | 619 | return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT); |
614 | } | 620 | } |
@@ -619,7 +625,8 @@ static inline int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd | |||
619 | * | 625 | * |
620 | * Returns true if the endpoint is of type bulk, otherwise it returns false. | 626 | * Returns true if the endpoint is of type bulk, otherwise it returns false. |
621 | */ | 627 | */ |
622 | static inline int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd) | 628 | static inline int usb_endpoint_xfer_bulk( |
629 | const struct usb_endpoint_descriptor *epd) | ||
623 | { | 630 | { |
624 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | 631 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == |
625 | USB_ENDPOINT_XFER_BULK); | 632 | USB_ENDPOINT_XFER_BULK); |
@@ -631,7 +638,8 @@ static inline int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *e | |||
631 | * | 638 | * |
632 | * Returns true if the endpoint is of type control, otherwise it returns false. | 639 | * Returns true if the endpoint is of type control, otherwise it returns false. |
633 | */ | 640 | */ |
634 | static inline int usb_endpoint_xfer_control(const struct usb_endpoint_descriptor *epd) | 641 | static inline int usb_endpoint_xfer_control( |
642 | const struct usb_endpoint_descriptor *epd) | ||
635 | { | 643 | { |
636 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | 644 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == |
637 | USB_ENDPOINT_XFER_CONTROL); | 645 | USB_ENDPOINT_XFER_CONTROL); |
@@ -644,7 +652,8 @@ static inline int usb_endpoint_xfer_control(const struct usb_endpoint_descriptor | |||
644 | * Returns true if the endpoint is of type interrupt, otherwise it returns | 652 | * Returns true if the endpoint is of type interrupt, otherwise it returns |
645 | * false. | 653 | * false. |
646 | */ | 654 | */ |
647 | static inline int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd) | 655 | static inline int usb_endpoint_xfer_int( |
656 | const struct usb_endpoint_descriptor *epd) | ||
648 | { | 657 | { |
649 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | 658 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == |
650 | USB_ENDPOINT_XFER_INT); | 659 | USB_ENDPOINT_XFER_INT); |
@@ -657,7 +666,8 @@ static inline int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *ep | |||
657 | * Returns true if the endpoint is of type isochronous, otherwise it returns | 666 | * Returns true if the endpoint is of type isochronous, otherwise it returns |
658 | * false. | 667 | * false. |
659 | */ | 668 | */ |
660 | static inline int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd) | 669 | static inline int usb_endpoint_xfer_isoc( |
670 | const struct usb_endpoint_descriptor *epd) | ||
661 | { | 671 | { |
662 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | 672 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == |
663 | USB_ENDPOINT_XFER_ISOC); | 673 | USB_ENDPOINT_XFER_ISOC); |
@@ -670,7 +680,8 @@ static inline int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *e | |||
670 | * Returns true if the endpoint has bulk transfer type and IN direction, | 680 | * Returns true if the endpoint has bulk transfer type and IN direction, |
671 | * otherwise it returns false. | 681 | * otherwise it returns false. |
672 | */ | 682 | */ |
673 | static inline int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd) | 683 | static inline int usb_endpoint_is_bulk_in( |
684 | const struct usb_endpoint_descriptor *epd) | ||
674 | { | 685 | { |
675 | return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd)); | 686 | return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd)); |
676 | } | 687 | } |
@@ -682,7 +693,8 @@ static inline int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor * | |||
682 | * Returns true if the endpoint has bulk transfer type and OUT direction, | 693 | * Returns true if the endpoint has bulk transfer type and OUT direction, |
683 | * otherwise it returns false. | 694 | * otherwise it returns false. |
684 | */ | 695 | */ |
685 | static inline int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd) | 696 | static inline int usb_endpoint_is_bulk_out( |
697 | const struct usb_endpoint_descriptor *epd) | ||
686 | { | 698 | { |
687 | return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd)); | 699 | return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd)); |
688 | } | 700 | } |
@@ -694,7 +706,8 @@ static inline int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor | |||
694 | * Returns true if the endpoint has interrupt transfer type and IN direction, | 706 | * Returns true if the endpoint has interrupt transfer type and IN direction, |
695 | * otherwise it returns false. | 707 | * otherwise it returns false. |
696 | */ | 708 | */ |
697 | static inline int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd) | 709 | static inline int usb_endpoint_is_int_in( |
710 | const struct usb_endpoint_descriptor *epd) | ||
698 | { | 711 | { |
699 | return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd)); | 712 | return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd)); |
700 | } | 713 | } |
@@ -706,7 +719,8 @@ static inline int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *e | |||
706 | * Returns true if the endpoint has interrupt transfer type and OUT direction, | 719 | * Returns true if the endpoint has interrupt transfer type and OUT direction, |
707 | * otherwise it returns false. | 720 | * otherwise it returns false. |
708 | */ | 721 | */ |
709 | static inline int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd) | 722 | static inline int usb_endpoint_is_int_out( |
723 | const struct usb_endpoint_descriptor *epd) | ||
710 | { | 724 | { |
711 | return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd)); | 725 | return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd)); |
712 | } | 726 | } |
@@ -718,7 +732,8 @@ static inline int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor * | |||
718 | * Returns true if the endpoint has isochronous transfer type and IN direction, | 732 | * Returns true if the endpoint has isochronous transfer type and IN direction, |
719 | * otherwise it returns false. | 733 | * otherwise it returns false. |
720 | */ | 734 | */ |
721 | static inline int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd) | 735 | static inline int usb_endpoint_is_isoc_in( |
736 | const struct usb_endpoint_descriptor *epd) | ||
722 | { | 737 | { |
723 | return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd)); | 738 | return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd)); |
724 | } | 739 | } |
@@ -730,7 +745,8 @@ static inline int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor * | |||
730 | * Returns true if the endpoint has isochronous transfer type and OUT direction, | 745 | * Returns true if the endpoint has isochronous transfer type and OUT direction, |
731 | * otherwise it returns false. | 746 | * otherwise it returns false. |
732 | */ | 747 | */ |
733 | static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor *epd) | 748 | static inline int usb_endpoint_is_isoc_out( |
749 | const struct usb_endpoint_descriptor *epd) | ||
734 | { | 750 | { |
735 | return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd)); | 751 | return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd)); |
736 | } | 752 | } |
@@ -761,8 +777,9 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor | |||
761 | * specific device. | 777 | * specific device. |
762 | */ | 778 | */ |
763 | #define USB_DEVICE(vend,prod) \ | 779 | #define USB_DEVICE(vend,prod) \ |
764 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = (vend), \ | 780 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \ |
765 | .idProduct = (prod) | 781 | .idVendor = (vend), \ |
782 | .idProduct = (prod) | ||
766 | /** | 783 | /** |
767 | * USB_DEVICE_VER - macro used to describe a specific usb device with a | 784 | * USB_DEVICE_VER - macro used to describe a specific usb device with a |
768 | * version range | 785 | * version range |
@@ -774,10 +791,12 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor | |||
774 | * This macro is used to create a struct usb_device_id that matches a | 791 | * This macro is used to create a struct usb_device_id that matches a |
775 | * specific device, with a version range. | 792 | * specific device, with a version range. |
776 | */ | 793 | */ |
777 | #define USB_DEVICE_VER(vend,prod,lo,hi) \ | 794 | #define USB_DEVICE_VER(vend, prod, lo, hi) \ |
778 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, \ | 795 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, \ |
779 | .idVendor = (vend), .idProduct = (prod), \ | 796 | .idVendor = (vend), \ |
780 | .bcdDevice_lo = (lo), .bcdDevice_hi = (hi) | 797 | .idProduct = (prod), \ |
798 | .bcdDevice_lo = (lo), \ | ||
799 | .bcdDevice_hi = (hi) | ||
781 | 800 | ||
782 | /** | 801 | /** |
783 | * USB_DEVICE_INTERFACE_PROTOCOL - macro used to describe a usb | 802 | * USB_DEVICE_INTERFACE_PROTOCOL - macro used to describe a usb |
@@ -789,8 +808,9 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor | |||
789 | * This macro is used to create a struct usb_device_id that matches a | 808 | * This macro is used to create a struct usb_device_id that matches a |
790 | * specific interface protocol of devices. | 809 | * specific interface protocol of devices. |
791 | */ | 810 | */ |
792 | #define USB_DEVICE_INTERFACE_PROTOCOL(vend,prod,pr) \ | 811 | #define USB_DEVICE_INTERFACE_PROTOCOL(vend, prod, pr) \ |
793 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_PROTOCOL, \ | 812 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ |
813 | USB_DEVICE_ID_MATCH_INT_PROTOCOL, \ | ||
794 | .idVendor = (vend), \ | 814 | .idVendor = (vend), \ |
795 | .idProduct = (prod), \ | 815 | .idProduct = (prod), \ |
796 | .bInterfaceProtocol = (pr) | 816 | .bInterfaceProtocol = (pr) |
@@ -804,12 +824,14 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor | |||
804 | * This macro is used to create a struct usb_device_id that matches a | 824 | * This macro is used to create a struct usb_device_id that matches a |
805 | * specific class of devices. | 825 | * specific class of devices. |
806 | */ | 826 | */ |
807 | #define USB_DEVICE_INFO(cl,sc,pr) \ | 827 | #define USB_DEVICE_INFO(cl, sc, pr) \ |
808 | .match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, .bDeviceClass = (cl), \ | 828 | .match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, \ |
809 | .bDeviceSubClass = (sc), .bDeviceProtocol = (pr) | 829 | .bDeviceClass = (cl), \ |
830 | .bDeviceSubClass = (sc), \ | ||
831 | .bDeviceProtocol = (pr) | ||
810 | 832 | ||
811 | /** | 833 | /** |
812 | * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces | 834 | * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces |
813 | * @cl: bInterfaceClass value | 835 | * @cl: bInterfaceClass value |
814 | * @sc: bInterfaceSubClass value | 836 | * @sc: bInterfaceSubClass value |
815 | * @pr: bInterfaceProtocol value | 837 | * @pr: bInterfaceProtocol value |
@@ -817,9 +839,11 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor | |||
817 | * This macro is used to create a struct usb_device_id that matches a | 839 | * This macro is used to create a struct usb_device_id that matches a |
818 | * specific class of interfaces. | 840 | * specific class of interfaces. |
819 | */ | 841 | */ |
820 | #define USB_INTERFACE_INFO(cl,sc,pr) \ | 842 | #define USB_INTERFACE_INFO(cl, sc, pr) \ |
821 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, .bInterfaceClass = (cl), \ | 843 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, \ |
822 | .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr) | 844 | .bInterfaceClass = (cl), \ |
845 | .bInterfaceSubClass = (sc), \ | ||
846 | .bInterfaceProtocol = (pr) | ||
823 | 847 | ||
824 | /** | 848 | /** |
825 | * USB_DEVICE_AND_INTERFACE_INFO - macro used to describe a specific usb device | 849 | * USB_DEVICE_AND_INTERFACE_INFO - macro used to describe a specific usb device |
@@ -836,12 +860,14 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor | |||
836 | * This is especially useful when explicitly matching devices that have | 860 | * This is especially useful when explicitly matching devices that have |
837 | * vendor specific bDeviceClass values, but standards-compliant interfaces. | 861 | * vendor specific bDeviceClass values, but standards-compliant interfaces. |
838 | */ | 862 | */ |
839 | #define USB_DEVICE_AND_INTERFACE_INFO(vend,prod,cl,sc,pr) \ | 863 | #define USB_DEVICE_AND_INTERFACE_INFO(vend, prod, cl, sc, pr) \ |
840 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \ | 864 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \ |
841 | | USB_DEVICE_ID_MATCH_DEVICE, \ | 865 | | USB_DEVICE_ID_MATCH_DEVICE, \ |
842 | .idVendor = (vend), .idProduct = (prod), \ | 866 | .idVendor = (vend), \ |
867 | .idProduct = (prod), \ | ||
843 | .bInterfaceClass = (cl), \ | 868 | .bInterfaceClass = (cl), \ |
844 | .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr) | 869 | .bInterfaceSubClass = (sc), \ |
870 | .bInterfaceProtocol = (pr) | ||
845 | 871 | ||
846 | /* ----------------------------------------------------------------------- */ | 872 | /* ----------------------------------------------------------------------- */ |
847 | 873 | ||
@@ -1119,7 +1145,7 @@ typedef void (*usb_complete_t)(struct urb *); | |||
1119 | * transferred. It will normally be the same as requested, unless | 1145 | * transferred. It will normally be the same as requested, unless |
1120 | * either an error was reported or a short read was performed. | 1146 | * either an error was reported or a short read was performed. |
1121 | * The URB_SHORT_NOT_OK transfer flag may be used to make such | 1147 | * The URB_SHORT_NOT_OK transfer flag may be used to make such |
1122 | * short reads be reported as errors. | 1148 | * short reads be reported as errors. |
1123 | * @setup_packet: Only used for control transfers, this points to eight bytes | 1149 | * @setup_packet: Only used for control transfers, this points to eight bytes |
1124 | * of setup data. Control transfers always start by sending this data | 1150 | * of setup data. Control transfers always start by sending this data |
1125 | * to the device. Then transfer_buffer is read or written, if needed. | 1151 | * to the device. Then transfer_buffer is read or written, if needed. |
@@ -1138,7 +1164,7 @@ typedef void (*usb_complete_t)(struct urb *); | |||
1138 | * @complete: Completion handler. This URB is passed as the parameter to the | 1164 | * @complete: Completion handler. This URB is passed as the parameter to the |
1139 | * completion function. The completion function may then do what | 1165 | * completion function. The completion function may then do what |
1140 | * it likes with the URB, including resubmitting or freeing it. | 1166 | * it likes with the URB, including resubmitting or freeing it. |
1141 | * @iso_frame_desc: Used to provide arrays of ISO transfer buffers and to | 1167 | * @iso_frame_desc: Used to provide arrays of ISO transfer buffers and to |
1142 | * collect the transfer status for each buffer. | 1168 | * collect the transfer status for each buffer. |
1143 | * | 1169 | * |
1144 | * This structure identifies USB transfer requests. URBs must be allocated by | 1170 | * This structure identifies USB transfer requests. URBs must be allocated by |
@@ -1242,8 +1268,7 @@ typedef void (*usb_complete_t)(struct urb *); | |||
1242 | * when the urb is owned by the hcd, that is, since the call to | 1268 | * when the urb is owned by the hcd, that is, since the call to |
1243 | * usb_submit_urb() till the entry into the completion routine. | 1269 | * usb_submit_urb() till the entry into the completion routine. |
1244 | */ | 1270 | */ |
1245 | struct urb | 1271 | struct urb { |
1246 | { | ||
1247 | /* private: usb core and host controller only fields in the urb */ | 1272 | /* private: usb core and host controller only fields in the urb */ |
1248 | struct kref kref; /* reference count of the URB */ | 1273 | struct kref kref; /* reference count of the URB */ |
1249 | void *hcpriv; /* private data for host controller */ | 1274 | void *hcpriv; /* private data for host controller */ |
@@ -1254,10 +1279,10 @@ struct urb | |||
1254 | /* public: documented fields in the urb that can be used by drivers */ | 1279 | /* public: documented fields in the urb that can be used by drivers */ |
1255 | struct list_head urb_list; /* list head for use by the urb's | 1280 | struct list_head urb_list; /* list head for use by the urb's |
1256 | * current owner */ | 1281 | * current owner */ |
1257 | struct list_head anchor_list; /* the URB may be anchored by the driver */ | 1282 | struct list_head anchor_list; /* the URB may be anchored */ |
1258 | struct usb_anchor *anchor; | 1283 | struct usb_anchor *anchor; |
1259 | struct usb_device *dev; /* (in) pointer to associated device */ | 1284 | struct usb_device *dev; /* (in) pointer to associated device */ |
1260 | struct usb_host_endpoint *ep; /* (internal) pointer to endpoint struct */ | 1285 | struct usb_host_endpoint *ep; /* (internal) pointer to endpoint */ |
1261 | unsigned int pipe; /* (in) pipe information */ | 1286 | unsigned int pipe; /* (in) pipe information */ |
1262 | int status; /* (return) non-ISO status */ | 1287 | int status; /* (return) non-ISO status */ |
1263 | unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ | 1288 | unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ |
@@ -1294,14 +1319,14 @@ struct urb | |||
1294 | * Initializes a control urb with the proper information needed to submit | 1319 | * Initializes a control urb with the proper information needed to submit |
1295 | * it to a device. | 1320 | * it to a device. |
1296 | */ | 1321 | */ |
1297 | static inline void usb_fill_control_urb (struct urb *urb, | 1322 | static inline void usb_fill_control_urb(struct urb *urb, |
1298 | struct usb_device *dev, | 1323 | struct usb_device *dev, |
1299 | unsigned int pipe, | 1324 | unsigned int pipe, |
1300 | unsigned char *setup_packet, | 1325 | unsigned char *setup_packet, |
1301 | void *transfer_buffer, | 1326 | void *transfer_buffer, |
1302 | int buffer_length, | 1327 | int buffer_length, |
1303 | usb_complete_t complete_fn, | 1328 | usb_complete_t complete_fn, |
1304 | void *context) | 1329 | void *context) |
1305 | { | 1330 | { |
1306 | urb->dev = dev; | 1331 | urb->dev = dev; |
1307 | urb->pipe = pipe; | 1332 | urb->pipe = pipe; |
@@ -1325,13 +1350,13 @@ static inline void usb_fill_control_urb (struct urb *urb, | |||
1325 | * Initializes a bulk urb with the proper information needed to submit it | 1350 | * Initializes a bulk urb with the proper information needed to submit it |
1326 | * to a device. | 1351 | * to a device. |
1327 | */ | 1352 | */ |
1328 | static inline void usb_fill_bulk_urb (struct urb *urb, | 1353 | static inline void usb_fill_bulk_urb(struct urb *urb, |
1329 | struct usb_device *dev, | 1354 | struct usb_device *dev, |
1330 | unsigned int pipe, | 1355 | unsigned int pipe, |
1331 | void *transfer_buffer, | 1356 | void *transfer_buffer, |
1332 | int buffer_length, | 1357 | int buffer_length, |
1333 | usb_complete_t complete_fn, | 1358 | usb_complete_t complete_fn, |
1334 | void *context) | 1359 | void *context) |
1335 | { | 1360 | { |
1336 | urb->dev = dev; | 1361 | urb->dev = dev; |
1337 | urb->pipe = pipe; | 1362 | urb->pipe = pipe; |
@@ -1359,14 +1384,14 @@ static inline void usb_fill_bulk_urb (struct urb *urb, | |||
1359 | * the endpoint interval, and express polling intervals in microframes | 1384 | * the endpoint interval, and express polling intervals in microframes |
1360 | * (eight per millisecond) rather than in frames (one per millisecond). | 1385 | * (eight per millisecond) rather than in frames (one per millisecond). |
1361 | */ | 1386 | */ |
1362 | static inline void usb_fill_int_urb (struct urb *urb, | 1387 | static inline void usb_fill_int_urb(struct urb *urb, |
1363 | struct usb_device *dev, | 1388 | struct usb_device *dev, |
1364 | unsigned int pipe, | 1389 | unsigned int pipe, |
1365 | void *transfer_buffer, | 1390 | void *transfer_buffer, |
1366 | int buffer_length, | 1391 | int buffer_length, |
1367 | usb_complete_t complete_fn, | 1392 | usb_complete_t complete_fn, |
1368 | void *context, | 1393 | void *context, |
1369 | int interval) | 1394 | int interval) |
1370 | { | 1395 | { |
1371 | urb->dev = dev; | 1396 | urb->dev = dev; |
1372 | urb->pipe = pipe; | 1397 | urb->pipe = pipe; |
@@ -1419,15 +1444,15 @@ static inline int usb_urb_dir_out(struct urb *urb) | |||
1419 | return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT; | 1444 | return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT; |
1420 | } | 1445 | } |
1421 | 1446 | ||
1422 | void *usb_buffer_alloc (struct usb_device *dev, size_t size, | 1447 | void *usb_buffer_alloc(struct usb_device *dev, size_t size, |
1423 | gfp_t mem_flags, dma_addr_t *dma); | 1448 | gfp_t mem_flags, dma_addr_t *dma); |
1424 | void usb_buffer_free (struct usb_device *dev, size_t size, | 1449 | void usb_buffer_free(struct usb_device *dev, size_t size, |
1425 | void *addr, dma_addr_t dma); | 1450 | void *addr, dma_addr_t dma); |
1426 | 1451 | ||
1427 | #if 0 | 1452 | #if 0 |
1428 | struct urb *usb_buffer_map (struct urb *urb); | 1453 | struct urb *usb_buffer_map(struct urb *urb); |
1429 | void usb_buffer_dmasync (struct urb *urb); | 1454 | void usb_buffer_dmasync(struct urb *urb); |
1430 | void usb_buffer_unmap (struct urb *urb); | 1455 | void usb_buffer_unmap(struct urb *urb); |
1431 | #endif | 1456 | #endif |
1432 | 1457 | ||
1433 | struct scatterlist; | 1458 | struct scatterlist; |
@@ -1499,7 +1524,7 @@ struct usb_sg_request { | |||
1499 | int status; | 1524 | int status; |
1500 | size_t bytes; | 1525 | size_t bytes; |
1501 | 1526 | ||
1502 | /* | 1527 | /* |
1503 | * members below are private: to usbcore, | 1528 | * members below are private: to usbcore, |
1504 | * and are not provided for driver access! | 1529 | * and are not provided for driver access! |
1505 | */ | 1530 | */ |
@@ -1517,18 +1542,18 @@ struct usb_sg_request { | |||
1517 | struct completion complete; | 1542 | struct completion complete; |
1518 | }; | 1543 | }; |
1519 | 1544 | ||
1520 | int usb_sg_init ( | 1545 | int usb_sg_init( |
1521 | struct usb_sg_request *io, | 1546 | struct usb_sg_request *io, |
1522 | struct usb_device *dev, | 1547 | struct usb_device *dev, |
1523 | unsigned pipe, | 1548 | unsigned pipe, |
1524 | unsigned period, | 1549 | unsigned period, |
1525 | struct scatterlist *sg, | 1550 | struct scatterlist *sg, |
1526 | int nents, | 1551 | int nents, |
1527 | size_t length, | 1552 | size_t length, |
1528 | gfp_t mem_flags | 1553 | gfp_t mem_flags |
1529 | ); | 1554 | ); |
1530 | void usb_sg_cancel (struct usb_sg_request *io); | 1555 | void usb_sg_cancel(struct usb_sg_request *io); |
1531 | void usb_sg_wait (struct usb_sg_request *io); | 1556 | void usb_sg_wait(struct usb_sg_request *io); |
1532 | 1557 | ||
1533 | 1558 | ||
1534 | /* ----------------------------------------------------------------------- */ | 1559 | /* ----------------------------------------------------------------------- */ |
@@ -1585,21 +1610,21 @@ static inline unsigned int __create_pipe(struct usb_device *dev, | |||
1585 | 1610 | ||
1586 | /* Create various pipes... */ | 1611 | /* Create various pipes... */ |
1587 | #define usb_sndctrlpipe(dev,endpoint) \ | 1612 | #define usb_sndctrlpipe(dev,endpoint) \ |
1588 | ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint)) | 1613 | ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint)) |
1589 | #define usb_rcvctrlpipe(dev,endpoint) \ | 1614 | #define usb_rcvctrlpipe(dev,endpoint) \ |
1590 | ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) | 1615 | ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) |
1591 | #define usb_sndisocpipe(dev,endpoint) \ | 1616 | #define usb_sndisocpipe(dev,endpoint) \ |
1592 | ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint)) | 1617 | ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint)) |
1593 | #define usb_rcvisocpipe(dev,endpoint) \ | 1618 | #define usb_rcvisocpipe(dev,endpoint) \ |
1594 | ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) | 1619 | ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) |
1595 | #define usb_sndbulkpipe(dev,endpoint) \ | 1620 | #define usb_sndbulkpipe(dev,endpoint) \ |
1596 | ((PIPE_BULK << 30) | __create_pipe(dev,endpoint)) | 1621 | ((PIPE_BULK << 30) | __create_pipe(dev, endpoint)) |
1597 | #define usb_rcvbulkpipe(dev,endpoint) \ | 1622 | #define usb_rcvbulkpipe(dev,endpoint) \ |
1598 | ((PIPE_BULK << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) | 1623 | ((PIPE_BULK << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) |
1599 | #define usb_sndintpipe(dev,endpoint) \ | 1624 | #define usb_sndintpipe(dev,endpoint) \ |
1600 | ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint)) | 1625 | ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint)) |
1601 | #define usb_rcvintpipe(dev,endpoint) \ | 1626 | #define usb_rcvintpipe(dev,endpoint) \ |
1602 | ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) | 1627 | ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) |
1603 | 1628 | ||
1604 | /*-------------------------------------------------------------------------*/ | 1629 | /*-------------------------------------------------------------------------*/ |
1605 | 1630 | ||
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild index 6ce42bf9f743..b8cba1dcb2c6 100644 --- a/include/linux/usb/Kbuild +++ b/include/linux/usb/Kbuild | |||
@@ -1,6 +1,7 @@ | |||
1 | unifdef-y += audio.h | 1 | header-y += audio.h |
2 | unifdef-y += cdc.h | 2 | header-y += cdc.h |
3 | unifdef-y += ch9.h | 3 | header-y += ch9.h |
4 | unifdef-y += gadgetfs.h | 4 | header-y += gadgetfs.h |
5 | unifdef-y += midi.h | 5 | header-y += midi.h |
6 | unifdef-y += g_printer.h | ||
6 | 7 | ||
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h index 6bd235994dc2..2dfeef16b221 100644 --- a/include/linux/usb/audio.h +++ b/include/linux/usb/audio.h | |||
@@ -27,13 +27,13 @@ | |||
27 | 27 | ||
28 | /* 4.3.2 Class-Specific AC Interface Descriptor */ | 28 | /* 4.3.2 Class-Specific AC Interface Descriptor */ |
29 | struct usb_ac_header_descriptor { | 29 | struct usb_ac_header_descriptor { |
30 | __u8 bLength; // 8+n | 30 | __u8 bLength; /* 8+n */ |
31 | __u8 bDescriptorType; // USB_DT_CS_INTERFACE | 31 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ |
32 | __u8 bDescriptorSubtype; // USB_MS_HEADER | 32 | __u8 bDescriptorSubtype; /* USB_MS_HEADER */ |
33 | __le16 bcdADC; // 0x0100 | 33 | __le16 bcdADC; /* 0x0100 */ |
34 | __le16 wTotalLength; // includes Unit and Terminal desc. | 34 | __le16 wTotalLength; /* includes Unit and Terminal desc. */ |
35 | __u8 bInCollection; // n | 35 | __u8 bInCollection; /* n */ |
36 | __u8 baInterfaceNr[]; // [n] | 36 | __u8 baInterfaceNr[]; /* [n] */ |
37 | } __attribute__ ((packed)); | 37 | } __attribute__ ((packed)); |
38 | 38 | ||
39 | #define USB_DT_AC_HEADER_SIZE(n) (8+(n)) | 39 | #define USB_DT_AC_HEADER_SIZE(n) (8+(n)) |
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h index 2204ae22c381..94ee4ecf0564 100644 --- a/include/linux/usb/cdc.h +++ b/include/linux/usb/cdc.h | |||
@@ -29,16 +29,16 @@ | |||
29 | * Class-Specific descriptors ... there are a couple dozen of them | 29 | * Class-Specific descriptors ... there are a couple dozen of them |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #define USB_CDC_HEADER_TYPE 0x00 /* header_desc */ | 32 | #define USB_CDC_HEADER_TYPE 0x00 /* header_desc */ |
33 | #define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */ | 33 | #define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */ |
34 | #define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */ | 34 | #define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */ |
35 | #define USB_CDC_UNION_TYPE 0x06 /* union_desc */ | 35 | #define USB_CDC_UNION_TYPE 0x06 /* union_desc */ |
36 | #define USB_CDC_COUNTRY_TYPE 0x07 | 36 | #define USB_CDC_COUNTRY_TYPE 0x07 |
37 | #define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */ | 37 | #define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */ |
38 | #define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */ | 38 | #define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */ |
39 | #define USB_CDC_WHCM_TYPE 0x11 | 39 | #define USB_CDC_WHCM_TYPE 0x11 |
40 | #define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */ | 40 | #define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */ |
41 | #define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */ | 41 | #define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */ |
42 | #define USB_CDC_DMM_TYPE 0x14 | 42 | #define USB_CDC_DMM_TYPE 0x14 |
43 | #define USB_CDC_OBEX_TYPE 0x15 | 43 | #define USB_CDC_OBEX_TYPE 0x15 |
44 | 44 | ||
diff --git a/include/linux/usb/g_printer.h b/include/linux/usb/g_printer.h new file mode 100644 index 000000000000..0c5ea1e3eb98 --- /dev/null +++ b/include/linux/usb/g_printer.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * g_printer.h -- Header file for USB Printer gadget driver | ||
3 | * | ||
4 | * Copyright (C) 2007 Craig W. Nadler | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | |||
22 | #define PRINTER_NOT_ERROR 0x08 | ||
23 | #define PRINTER_SELECTED 0x10 | ||
24 | #define PRINTER_PAPER_EMPTY 0x20 | ||
25 | |||
26 | /* The 'g' code is also used by gadgetfs ioctl requests. | ||
27 | * Don't add any colliding codes to either driver, and keep | ||
28 | * them in unique ranges (size 0x20 for now). | ||
29 | */ | ||
30 | #define GADGET_GET_PRINTER_STATUS _IOR('g', 0x21, unsigned char) | ||
31 | #define GADGET_SET_PRINTER_STATUS _IOWR('g', 0x22, unsigned char) | ||
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index c1527c2ef3cb..aa3047ff00d1 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h | |||
@@ -70,9 +70,10 @@ struct usb_ep; | |||
70 | * | 70 | * |
71 | * Bulk endpoints can use any size buffers, and can also be used for interrupt | 71 | * Bulk endpoints can use any size buffers, and can also be used for interrupt |
72 | * transfers. interrupt-only endpoints can be much less functional. | 72 | * transfers. interrupt-only endpoints can be much less functional. |
73 | * | ||
74 | * NOTE: this is analagous to 'struct urb' on the host side, except that | ||
75 | * it's thinner and promotes more pre-allocation. | ||
73 | */ | 76 | */ |
74 | // NOTE this is analagous to 'struct urb' on the host side, | ||
75 | // except that it's thinner and promotes more pre-allocation. | ||
76 | 77 | ||
77 | struct usb_request { | 78 | struct usb_request { |
78 | void *buf; | 79 | void *buf; |
@@ -168,10 +169,10 @@ struct usb_ep { | |||
168 | * | 169 | * |
169 | * returns zero, or a negative error code. | 170 | * returns zero, or a negative error code. |
170 | */ | 171 | */ |
171 | static inline int | 172 | static inline int usb_ep_enable(struct usb_ep *ep, |
172 | usb_ep_enable (struct usb_ep *ep, const struct usb_endpoint_descriptor *desc) | 173 | const struct usb_endpoint_descriptor *desc) |
173 | { | 174 | { |
174 | return ep->ops->enable (ep, desc); | 175 | return ep->ops->enable(ep, desc); |
175 | } | 176 | } |
176 | 177 | ||
177 | /** | 178 | /** |
@@ -186,10 +187,9 @@ usb_ep_enable (struct usb_ep *ep, const struct usb_endpoint_descriptor *desc) | |||
186 | * | 187 | * |
187 | * returns zero, or a negative error code. | 188 | * returns zero, or a negative error code. |
188 | */ | 189 | */ |
189 | static inline int | 190 | static inline int usb_ep_disable(struct usb_ep *ep) |
190 | usb_ep_disable (struct usb_ep *ep) | ||
191 | { | 191 | { |
192 | return ep->ops->disable (ep); | 192 | return ep->ops->disable(ep); |
193 | } | 193 | } |
194 | 194 | ||
195 | /** | 195 | /** |
@@ -206,10 +206,10 @@ usb_ep_disable (struct usb_ep *ep) | |||
206 | * | 206 | * |
207 | * Returns the request, or null if one could not be allocated. | 207 | * Returns the request, or null if one could not be allocated. |
208 | */ | 208 | */ |
209 | static inline struct usb_request * | 209 | static inline struct usb_request *usb_ep_alloc_request(struct usb_ep *ep, |
210 | usb_ep_alloc_request (struct usb_ep *ep, gfp_t gfp_flags) | 210 | gfp_t gfp_flags) |
211 | { | 211 | { |
212 | return ep->ops->alloc_request (ep, gfp_flags); | 212 | return ep->ops->alloc_request(ep, gfp_flags); |
213 | } | 213 | } |
214 | 214 | ||
215 | /** | 215 | /** |
@@ -221,10 +221,10 @@ usb_ep_alloc_request (struct usb_ep *ep, gfp_t gfp_flags) | |||
221 | * Caller guarantees the request is not queued, and that it will | 221 | * Caller guarantees the request is not queued, and that it will |
222 | * no longer be requeued (or otherwise used). | 222 | * no longer be requeued (or otherwise used). |
223 | */ | 223 | */ |
224 | static inline void | 224 | static inline void usb_ep_free_request(struct usb_ep *ep, |
225 | usb_ep_free_request (struct usb_ep *ep, struct usb_request *req) | 225 | struct usb_request *req) |
226 | { | 226 | { |
227 | ep->ops->free_request (ep, req); | 227 | ep->ops->free_request(ep, req); |
228 | } | 228 | } |
229 | 229 | ||
230 | /** | 230 | /** |
@@ -281,10 +281,10 @@ usb_ep_free_request (struct usb_ep *ep, struct usb_request *req) | |||
281 | * report errors; errors will also be | 281 | * report errors; errors will also be |
282 | * reported when the usb peripheral is disconnected. | 282 | * reported when the usb peripheral is disconnected. |
283 | */ | 283 | */ |
284 | static inline int | 284 | static inline int usb_ep_queue(struct usb_ep *ep, |
285 | usb_ep_queue (struct usb_ep *ep, struct usb_request *req, gfp_t gfp_flags) | 285 | struct usb_request *req, gfp_t gfp_flags) |
286 | { | 286 | { |
287 | return ep->ops->queue (ep, req, gfp_flags); | 287 | return ep->ops->queue(ep, req, gfp_flags); |
288 | } | 288 | } |
289 | 289 | ||
290 | /** | 290 | /** |
@@ -301,9 +301,9 @@ usb_ep_queue (struct usb_ep *ep, struct usb_request *req, gfp_t gfp_flags) | |||
301 | * restrictions prevent drivers from supporting configuration changes, | 301 | * restrictions prevent drivers from supporting configuration changes, |
302 | * even to configuration zero (a "chapter 9" requirement). | 302 | * even to configuration zero (a "chapter 9" requirement). |
303 | */ | 303 | */ |
304 | static inline int usb_ep_dequeue (struct usb_ep *ep, struct usb_request *req) | 304 | static inline int usb_ep_dequeue(struct usb_ep *ep, struct usb_request *req) |
305 | { | 305 | { |
306 | return ep->ops->dequeue (ep, req); | 306 | return ep->ops->dequeue(ep, req); |
307 | } | 307 | } |
308 | 308 | ||
309 | /** | 309 | /** |
@@ -327,10 +327,9 @@ static inline int usb_ep_dequeue (struct usb_ep *ep, struct usb_request *req) | |||
327 | * transfer requests are still queued, or if the controller hardware | 327 | * transfer requests are still queued, or if the controller hardware |
328 | * (usually a FIFO) still holds bytes that the host hasn't collected. | 328 | * (usually a FIFO) still holds bytes that the host hasn't collected. |
329 | */ | 329 | */ |
330 | static inline int | 330 | static inline int usb_ep_set_halt(struct usb_ep *ep) |
331 | usb_ep_set_halt (struct usb_ep *ep) | ||
332 | { | 331 | { |
333 | return ep->ops->set_halt (ep, 1); | 332 | return ep->ops->set_halt(ep, 1); |
334 | } | 333 | } |
335 | 334 | ||
336 | /** | 335 | /** |
@@ -346,10 +345,9 @@ usb_ep_set_halt (struct usb_ep *ep) | |||
346 | * Note that some hardware can't support this request (like pxa2xx_udc), | 345 | * Note that some hardware can't support this request (like pxa2xx_udc), |
347 | * and accordingly can't correctly implement interface altsettings. | 346 | * and accordingly can't correctly implement interface altsettings. |
348 | */ | 347 | */ |
349 | static inline int | 348 | static inline int usb_ep_clear_halt(struct usb_ep *ep) |
350 | usb_ep_clear_halt (struct usb_ep *ep) | ||
351 | { | 349 | { |
352 | return ep->ops->set_halt (ep, 0); | 350 | return ep->ops->set_halt(ep, 0); |
353 | } | 351 | } |
354 | 352 | ||
355 | /** | 353 | /** |
@@ -367,11 +365,10 @@ usb_ep_clear_halt (struct usb_ep *ep) | |||
367 | * errno if the endpoint doesn't use a FIFO or doesn't support such | 365 | * errno if the endpoint doesn't use a FIFO or doesn't support such |
368 | * precise handling. | 366 | * precise handling. |
369 | */ | 367 | */ |
370 | static inline int | 368 | static inline int usb_ep_fifo_status(struct usb_ep *ep) |
371 | usb_ep_fifo_status (struct usb_ep *ep) | ||
372 | { | 369 | { |
373 | if (ep->ops->fifo_status) | 370 | if (ep->ops->fifo_status) |
374 | return ep->ops->fifo_status (ep); | 371 | return ep->ops->fifo_status(ep); |
375 | else | 372 | else |
376 | return -EOPNOTSUPP; | 373 | return -EOPNOTSUPP; |
377 | } | 374 | } |
@@ -385,11 +382,10 @@ usb_ep_fifo_status (struct usb_ep *ep) | |||
385 | * must never be used except when endpoint is not being used for any | 382 | * must never be used except when endpoint is not being used for any |
386 | * protocol translation. | 383 | * protocol translation. |
387 | */ | 384 | */ |
388 | static inline void | 385 | static inline void usb_ep_fifo_flush(struct usb_ep *ep) |
389 | usb_ep_fifo_flush (struct usb_ep *ep) | ||
390 | { | 386 | { |
391 | if (ep->ops->fifo_flush) | 387 | if (ep->ops->fifo_flush) |
392 | ep->ops->fifo_flush (ep); | 388 | ep->ops->fifo_flush(ep); |
393 | } | 389 | } |
394 | 390 | ||
395 | 391 | ||
@@ -469,10 +465,10 @@ struct usb_gadget { | |||
469 | struct device dev; | 465 | struct device dev; |
470 | }; | 466 | }; |
471 | 467 | ||
472 | static inline void set_gadget_data (struct usb_gadget *gadget, void *data) | 468 | static inline void set_gadget_data(struct usb_gadget *gadget, void *data) |
473 | { dev_set_drvdata (&gadget->dev, data); } | 469 | { dev_set_drvdata(&gadget->dev, data); } |
474 | static inline void *get_gadget_data (struct usb_gadget *gadget) | 470 | static inline void *get_gadget_data(struct usb_gadget *gadget) |
475 | { return dev_get_drvdata (&gadget->dev); } | 471 | { return dev_get_drvdata(&gadget->dev); } |
476 | 472 | ||
477 | /* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */ | 473 | /* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */ |
478 | #define gadget_for_each_ep(tmp,gadget) \ | 474 | #define gadget_for_each_ep(tmp,gadget) \ |
@@ -511,7 +507,6 @@ static inline int gadget_is_otg(struct usb_gadget *g) | |||
511 | #endif | 507 | #endif |
512 | } | 508 | } |
513 | 509 | ||
514 | |||
515 | /** | 510 | /** |
516 | * usb_gadget_frame_number - returns the current frame number | 511 | * usb_gadget_frame_number - returns the current frame number |
517 | * @gadget: controller that reports the frame number | 512 | * @gadget: controller that reports the frame number |
@@ -519,9 +514,9 @@ static inline int gadget_is_otg(struct usb_gadget *g) | |||
519 | * Returns the usb frame number, normally eleven bits from a SOF packet, | 514 | * Returns the usb frame number, normally eleven bits from a SOF packet, |
520 | * or negative errno if this device doesn't support this capability. | 515 | * or negative errno if this device doesn't support this capability. |
521 | */ | 516 | */ |
522 | static inline int usb_gadget_frame_number (struct usb_gadget *gadget) | 517 | static inline int usb_gadget_frame_number(struct usb_gadget *gadget) |
523 | { | 518 | { |
524 | return gadget->ops->get_frame (gadget); | 519 | return gadget->ops->get_frame(gadget); |
525 | } | 520 | } |
526 | 521 | ||
527 | /** | 522 | /** |
@@ -537,11 +532,11 @@ static inline int usb_gadget_frame_number (struct usb_gadget *gadget) | |||
537 | * even if OTG isn't otherwise in use. OTG devices may also start | 532 | * even if OTG isn't otherwise in use. OTG devices may also start |
538 | * remote wakeup even when hosts don't explicitly enable it. | 533 | * remote wakeup even when hosts don't explicitly enable it. |
539 | */ | 534 | */ |
540 | static inline int usb_gadget_wakeup (struct usb_gadget *gadget) | 535 | static inline int usb_gadget_wakeup(struct usb_gadget *gadget) |
541 | { | 536 | { |
542 | if (!gadget->ops->wakeup) | 537 | if (!gadget->ops->wakeup) |
543 | return -EOPNOTSUPP; | 538 | return -EOPNOTSUPP; |
544 | return gadget->ops->wakeup (gadget); | 539 | return gadget->ops->wakeup(gadget); |
545 | } | 540 | } |
546 | 541 | ||
547 | /** | 542 | /** |
@@ -553,12 +548,11 @@ static inline int usb_gadget_wakeup (struct usb_gadget *gadget) | |||
553 | * | 548 | * |
554 | * returns zero on success, else negative errno. | 549 | * returns zero on success, else negative errno. |
555 | */ | 550 | */ |
556 | static inline int | 551 | static inline int usb_gadget_set_selfpowered(struct usb_gadget *gadget) |
557 | usb_gadget_set_selfpowered (struct usb_gadget *gadget) | ||
558 | { | 552 | { |
559 | if (!gadget->ops->set_selfpowered) | 553 | if (!gadget->ops->set_selfpowered) |
560 | return -EOPNOTSUPP; | 554 | return -EOPNOTSUPP; |
561 | return gadget->ops->set_selfpowered (gadget, 1); | 555 | return gadget->ops->set_selfpowered(gadget, 1); |
562 | } | 556 | } |
563 | 557 | ||
564 | /** | 558 | /** |
@@ -571,12 +565,11 @@ usb_gadget_set_selfpowered (struct usb_gadget *gadget) | |||
571 | * | 565 | * |
572 | * returns zero on success, else negative errno. | 566 | * returns zero on success, else negative errno. |
573 | */ | 567 | */ |
574 | static inline int | 568 | static inline int usb_gadget_clear_selfpowered(struct usb_gadget *gadget) |
575 | usb_gadget_clear_selfpowered (struct usb_gadget *gadget) | ||
576 | { | 569 | { |
577 | if (!gadget->ops->set_selfpowered) | 570 | if (!gadget->ops->set_selfpowered) |
578 | return -EOPNOTSUPP; | 571 | return -EOPNOTSUPP; |
579 | return gadget->ops->set_selfpowered (gadget, 0); | 572 | return gadget->ops->set_selfpowered(gadget, 0); |
580 | } | 573 | } |
581 | 574 | ||
582 | /** | 575 | /** |
@@ -591,12 +584,11 @@ usb_gadget_clear_selfpowered (struct usb_gadget *gadget) | |||
591 | * | 584 | * |
592 | * Returns zero on success, else negative errno. | 585 | * Returns zero on success, else negative errno. |
593 | */ | 586 | */ |
594 | static inline int | 587 | static inline int usb_gadget_vbus_connect(struct usb_gadget *gadget) |
595 | usb_gadget_vbus_connect(struct usb_gadget *gadget) | ||
596 | { | 588 | { |
597 | if (!gadget->ops->vbus_session) | 589 | if (!gadget->ops->vbus_session) |
598 | return -EOPNOTSUPP; | 590 | return -EOPNOTSUPP; |
599 | return gadget->ops->vbus_session (gadget, 1); | 591 | return gadget->ops->vbus_session(gadget, 1); |
600 | } | 592 | } |
601 | 593 | ||
602 | /** | 594 | /** |
@@ -611,12 +603,11 @@ usb_gadget_vbus_connect(struct usb_gadget *gadget) | |||
611 | * | 603 | * |
612 | * Returns zero on success, else negative errno. | 604 | * Returns zero on success, else negative errno. |
613 | */ | 605 | */ |
614 | static inline int | 606 | static inline int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA) |
615 | usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA) | ||
616 | { | 607 | { |
617 | if (!gadget->ops->vbus_draw) | 608 | if (!gadget->ops->vbus_draw) |
618 | return -EOPNOTSUPP; | 609 | return -EOPNOTSUPP; |
619 | return gadget->ops->vbus_draw (gadget, mA); | 610 | return gadget->ops->vbus_draw(gadget, mA); |
620 | } | 611 | } |
621 | 612 | ||
622 | /** | 613 | /** |
@@ -629,12 +620,11 @@ usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA) | |||
629 | * | 620 | * |
630 | * Returns zero on success, else negative errno. | 621 | * Returns zero on success, else negative errno. |
631 | */ | 622 | */ |
632 | static inline int | 623 | static inline int usb_gadget_vbus_disconnect(struct usb_gadget *gadget) |
633 | usb_gadget_vbus_disconnect(struct usb_gadget *gadget) | ||
634 | { | 624 | { |
635 | if (!gadget->ops->vbus_session) | 625 | if (!gadget->ops->vbus_session) |
636 | return -EOPNOTSUPP; | 626 | return -EOPNOTSUPP; |
637 | return gadget->ops->vbus_session (gadget, 0); | 627 | return gadget->ops->vbus_session(gadget, 0); |
638 | } | 628 | } |
639 | 629 | ||
640 | /** | 630 | /** |
@@ -648,12 +638,11 @@ usb_gadget_vbus_disconnect(struct usb_gadget *gadget) | |||
648 | * | 638 | * |
649 | * Returns zero on success, else negative errno. | 639 | * Returns zero on success, else negative errno. |
650 | */ | 640 | */ |
651 | static inline int | 641 | static inline int usb_gadget_connect(struct usb_gadget *gadget) |
652 | usb_gadget_connect (struct usb_gadget *gadget) | ||
653 | { | 642 | { |
654 | if (!gadget->ops->pullup) | 643 | if (!gadget->ops->pullup) |
655 | return -EOPNOTSUPP; | 644 | return -EOPNOTSUPP; |
656 | return gadget->ops->pullup (gadget, 1); | 645 | return gadget->ops->pullup(gadget, 1); |
657 | } | 646 | } |
658 | 647 | ||
659 | /** | 648 | /** |
@@ -671,16 +660,14 @@ usb_gadget_connect (struct usb_gadget *gadget) | |||
671 | * | 660 | * |
672 | * Returns zero on success, else negative errno. | 661 | * Returns zero on success, else negative errno. |
673 | */ | 662 | */ |
674 | static inline int | 663 | static inline int usb_gadget_disconnect(struct usb_gadget *gadget) |
675 | usb_gadget_disconnect (struct usb_gadget *gadget) | ||
676 | { | 664 | { |
677 | if (!gadget->ops->pullup) | 665 | if (!gadget->ops->pullup) |
678 | return -EOPNOTSUPP; | 666 | return -EOPNOTSUPP; |
679 | return gadget->ops->pullup (gadget, 0); | 667 | return gadget->ops->pullup(gadget, 0); |
680 | } | 668 | } |
681 | 669 | ||
682 | 670 | ||
683 | |||
684 | /*-------------------------------------------------------------------------*/ | 671 | /*-------------------------------------------------------------------------*/ |
685 | 672 | ||
686 | /** | 673 | /** |
@@ -764,7 +751,7 @@ struct usb_gadget_driver { | |||
764 | void (*suspend)(struct usb_gadget *); | 751 | void (*suspend)(struct usb_gadget *); |
765 | void (*resume)(struct usb_gadget *); | 752 | void (*resume)(struct usb_gadget *); |
766 | 753 | ||
767 | // FIXME support safe rmmod | 754 | /* FIXME support safe rmmod */ |
768 | struct device_driver driver; | 755 | struct device_driver driver; |
769 | }; | 756 | }; |
770 | 757 | ||
@@ -790,7 +777,7 @@ struct usb_gadget_driver { | |||
790 | * the bind() functions will be in init sections. | 777 | * the bind() functions will be in init sections. |
791 | * This function must be called in a context that can sleep. | 778 | * This function must be called in a context that can sleep. |
792 | */ | 779 | */ |
793 | int usb_gadget_register_driver (struct usb_gadget_driver *driver); | 780 | int usb_gadget_register_driver(struct usb_gadget_driver *driver); |
794 | 781 | ||
795 | /** | 782 | /** |
796 | * usb_gadget_unregister_driver - unregister a gadget driver | 783 | * usb_gadget_unregister_driver - unregister a gadget driver |
@@ -805,7 +792,7 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver); | |||
805 | * will in in exit sections, so may not be linked in some kernels. | 792 | * will in in exit sections, so may not be linked in some kernels. |
806 | * This function must be called in a context that can sleep. | 793 | * This function must be called in a context that can sleep. |
807 | */ | 794 | */ |
808 | int usb_gadget_unregister_driver (struct usb_gadget_driver *driver); | 795 | int usb_gadget_unregister_driver(struct usb_gadget_driver *driver); |
809 | 796 | ||
810 | /*-------------------------------------------------------------------------*/ | 797 | /*-------------------------------------------------------------------------*/ |
811 | 798 | ||
@@ -838,7 +825,7 @@ struct usb_gadget_strings { | |||
838 | }; | 825 | }; |
839 | 826 | ||
840 | /* put descriptor for string with that id into buf (buflen >= 256) */ | 827 | /* put descriptor for string with that id into buf (buflen >= 256) */ |
841 | int usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf); | 828 | int usb_gadget_get_string(struct usb_gadget_strings *table, int id, u8 *buf); |
842 | 829 | ||
843 | /*-------------------------------------------------------------------------*/ | 830 | /*-------------------------------------------------------------------------*/ |
844 | 831 | ||
@@ -856,10 +843,10 @@ int usb_gadget_config_buf(const struct usb_config_descriptor *config, | |||
856 | 843 | ||
857 | /* utility wrapping a simple endpoint selection policy */ | 844 | /* utility wrapping a simple endpoint selection policy */ |
858 | 845 | ||
859 | extern struct usb_ep *usb_ep_autoconfig (struct usb_gadget *, | 846 | extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, |
860 | struct usb_endpoint_descriptor *) __devinit; | 847 | struct usb_endpoint_descriptor *) __devinit; |
861 | 848 | ||
862 | extern void usb_ep_autoconfig_reset (struct usb_gadget *) __devinit; | 849 | extern void usb_ep_autoconfig_reset(struct usb_gadget *) __devinit; |
863 | 850 | ||
864 | #endif /* __KERNEL__ */ | 851 | #endif /* __KERNEL__ */ |
865 | 852 | ||
diff --git a/include/linux/usb/gadgetfs.h b/include/linux/usb/gadgetfs.h index e8654c338729..c291ab1af747 100644 --- a/include/linux/usb/gadgetfs.h +++ b/include/linux/usb/gadgetfs.h | |||
@@ -36,7 +36,7 @@ enum usb_gadgetfs_event_type { | |||
36 | GADGETFS_DISCONNECT, | 36 | GADGETFS_DISCONNECT, |
37 | GADGETFS_SETUP, | 37 | GADGETFS_SETUP, |
38 | GADGETFS_SUSPEND, | 38 | GADGETFS_SUSPEND, |
39 | // and likely more ! | 39 | /* and likely more ! */ |
40 | }; | 40 | }; |
41 | 41 | ||
42 | /* NOTE: this structure must stay the same size and layout on | 42 | /* NOTE: this structure must stay the same size and layout on |
@@ -44,21 +44,28 @@ enum usb_gadgetfs_event_type { | |||
44 | */ | 44 | */ |
45 | struct usb_gadgetfs_event { | 45 | struct usb_gadgetfs_event { |
46 | union { | 46 | union { |
47 | // NOP, DISCONNECT, SUSPEND: nothing | 47 | /* NOP, DISCONNECT, SUSPEND: nothing |
48 | // ... some hardware can't report disconnection | 48 | * ... some hardware can't report disconnection |
49 | */ | ||
49 | 50 | ||
50 | // CONNECT: just the speed | 51 | /* CONNECT: just the speed */ |
51 | enum usb_device_speed speed; | 52 | enum usb_device_speed speed; |
52 | 53 | ||
53 | // SETUP: packet; DATA phase i/o precedes next event | 54 | /* SETUP: packet; DATA phase i/o precedes next event |
54 | // (setup.bmRequestType & USB_DIR_IN) flags direction | 55 | *(setup.bmRequestType & USB_DIR_IN) flags direction |
55 | // ... includes SET_CONFIGURATION, SET_INTERFACE | 56 | * ... includes SET_CONFIGURATION, SET_INTERFACE |
57 | */ | ||
56 | struct usb_ctrlrequest setup; | 58 | struct usb_ctrlrequest setup; |
57 | } u; | 59 | } u; |
58 | enum usb_gadgetfs_event_type type; | 60 | enum usb_gadgetfs_event_type type; |
59 | }; | 61 | }; |
60 | 62 | ||
61 | 63 | ||
64 | /* The 'g' code is also used by printer gadget ioctl requests. | ||
65 | * Don't add any colliding codes to either driver, and keep | ||
66 | * them in unique ranges (size 0x20 for now). | ||
67 | */ | ||
68 | |||
62 | /* endpoint ioctls */ | 69 | /* endpoint ioctls */ |
63 | 70 | ||
64 | /* IN transfers may be reported to the gadget driver as complete | 71 | /* IN transfers may be reported to the gadget driver as complete |
@@ -68,14 +75,14 @@ struct usb_gadgetfs_event { | |||
68 | * THIS returns how many bytes are "unclaimed" in the endpoint fifo | 75 | * THIS returns how many bytes are "unclaimed" in the endpoint fifo |
69 | * (needed for precise fault handling, when the hardware allows it) | 76 | * (needed for precise fault handling, when the hardware allows it) |
70 | */ | 77 | */ |
71 | #define GADGETFS_FIFO_STATUS _IO('g',1) | 78 | #define GADGETFS_FIFO_STATUS _IO('g', 1) |
72 | 79 | ||
73 | /* discards any unclaimed data in the fifo. */ | 80 | /* discards any unclaimed data in the fifo. */ |
74 | #define GADGETFS_FIFO_FLUSH _IO('g',2) | 81 | #define GADGETFS_FIFO_FLUSH _IO('g', 2) |
75 | 82 | ||
76 | /* resets endpoint halt+toggle; used to implement set_interface. | 83 | /* resets endpoint halt+toggle; used to implement set_interface. |
77 | * some hardware (like pxa2xx) can't support this. | 84 | * some hardware (like pxa2xx) can't support this. |
78 | */ | 85 | */ |
79 | #define GADGETFS_CLEAR_HALT _IO('g',3) | 86 | #define GADGETFS_CLEAR_HALT _IO('g', 3) |
80 | 87 | ||
81 | #endif /* __LINUX_USB_GADGETFS_H */ | 88 | #endif /* __LINUX_USB_GADGETFS_H */ |
diff --git a/include/linux/usb/iowarrior.h b/include/linux/usb/iowarrior.h index cbbe020a4f5c..de6f380e17a2 100644 --- a/include/linux/usb/iowarrior.h +++ b/include/linux/usb/iowarrior.h | |||
@@ -14,14 +14,23 @@ | |||
14 | this information. | 14 | this information. |
15 | */ | 15 | */ |
16 | struct iowarrior_info { | 16 | struct iowarrior_info { |
17 | __u32 vendor; /* vendor id : supposed to be USB_VENDOR_ID_CODEMERCS in all cases */ | 17 | /* vendor id : supposed to be USB_VENDOR_ID_CODEMERCS in all cases */ |
18 | __u32 product; /* product id : depends on type of chip (USB_DEVICE_ID_CODEMERCS_XXXXX) */ | 18 | __u32 vendor; |
19 | __u8 serial[9]; /* the serial number of our chip (if a serial-number is not available this is empty string) */ | 19 | /* product id : depends on type of chip (USB_DEVICE_ID_CODEMERCS_X) */ |
20 | __u32 revision; /* revision number of the chip */ | 20 | __u32 product; |
21 | __u32 speed; /* USB-speed of the device (0=UNKNOWN, 1=LOW, 2=FULL 3=HIGH) */ | 21 | /* the serial number of our chip (if a serial-number is not available |
22 | __u32 power; /* power consumption of the device in mA */ | 22 | * this is empty string) */ |
23 | __u32 if_num; /* the number of the endpoint */ | 23 | __u8 serial[9]; |
24 | __u32 report_size; /* size of the data-packets on this interface */ | 24 | /* revision number of the chip */ |
25 | __u32 revision; | ||
26 | /* USB-speed of the device (0=UNKNOWN, 1=LOW, 2=FULL 3=HIGH) */ | ||
27 | __u32 speed; | ||
28 | /* power consumption of the device in mA */ | ||
29 | __u32 power; | ||
30 | /* the number of the endpoint */ | ||
31 | __u32 if_num; | ||
32 | /* size of the data-packets on this interface */ | ||
33 | __u32 report_size; | ||
25 | }; | 34 | }; |
26 | 35 | ||
27 | /* | 36 | /* |
diff --git a/include/linux/usb/isp116x.h b/include/linux/usb/isp116x.h index 436dd8a2b64a..67d2826f34fe 100644 --- a/include/linux/usb/isp116x.h +++ b/include/linux/usb/isp116x.h | |||
@@ -25,5 +25,5 @@ struct isp116x_platform_data { | |||
25 | 300ns delay between access to ADDR_REG and DATA_REG | 25 | 300ns delay between access to ADDR_REG and DATA_REG |
26 | OE, WE MUST NOT be changed during these intervals | 26 | OE, WE MUST NOT be changed during these intervals |
27 | */ | 27 | */ |
28 | void (*delay) (struct device * dev, int delay); | 28 | void (*delay) (struct device *dev, int delay); |
29 | }; | 29 | }; |
diff --git a/include/linux/usb/midi.h b/include/linux/usb/midi.h index 11a97d5ffd34..80624c562921 100644 --- a/include/linux/usb/midi.h +++ b/include/linux/usb/midi.h | |||
@@ -47,9 +47,9 @@ struct usb_ms_header_descriptor { | |||
47 | /* 6.1.2.2 MIDI IN Jack Descriptor */ | 47 | /* 6.1.2.2 MIDI IN Jack Descriptor */ |
48 | struct usb_midi_in_jack_descriptor { | 48 | struct usb_midi_in_jack_descriptor { |
49 | __u8 bLength; | 49 | __u8 bLength; |
50 | __u8 bDescriptorType; // USB_DT_CS_INTERFACE | 50 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ |
51 | __u8 bDescriptorSubtype; // USB_MS_MIDI_IN_JACK | 51 | __u8 bDescriptorSubtype; /* USB_MS_MIDI_IN_JACK */ |
52 | __u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL | 52 | __u8 bJackType; /* USB_MS_EMBEDDED/EXTERNAL */ |
53 | __u8 bJackID; | 53 | __u8 bJackID; |
54 | __u8 iJack; | 54 | __u8 iJack; |
55 | } __attribute__ ((packed)); | 55 | } __attribute__ ((packed)); |
@@ -64,12 +64,12 @@ struct usb_midi_source_pin { | |||
64 | /* 6.1.2.3 MIDI OUT Jack Descriptor */ | 64 | /* 6.1.2.3 MIDI OUT Jack Descriptor */ |
65 | struct usb_midi_out_jack_descriptor { | 65 | struct usb_midi_out_jack_descriptor { |
66 | __u8 bLength; | 66 | __u8 bLength; |
67 | __u8 bDescriptorType; // USB_DT_CS_INTERFACE | 67 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ |
68 | __u8 bDescriptorSubtype; // USB_MS_MIDI_OUT_JACK | 68 | __u8 bDescriptorSubtype; /* USB_MS_MIDI_OUT_JACK */ |
69 | __u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL | 69 | __u8 bJackType; /* USB_MS_EMBEDDED/EXTERNAL */ |
70 | __u8 bJackID; | 70 | __u8 bJackID; |
71 | __u8 bNrInputPins; // p | 71 | __u8 bNrInputPins; /* p */ |
72 | struct usb_midi_source_pin pins[]; // [p] | 72 | struct usb_midi_source_pin pins[]; /* [p] */ |
73 | /*__u8 iJack; -- ommitted due to variable-sized pins[] */ | 73 | /*__u8 iJack; -- ommitted due to variable-sized pins[] */ |
74 | } __attribute__ ((packed)); | 74 | } __attribute__ ((packed)); |
75 | 75 | ||
@@ -90,11 +90,11 @@ struct usb_midi_out_jack_descriptor_##p { \ | |||
90 | 90 | ||
91 | /* 6.2.2 Class-Specific MS Bulk Data Endpoint Descriptor */ | 91 | /* 6.2.2 Class-Specific MS Bulk Data Endpoint Descriptor */ |
92 | struct usb_ms_endpoint_descriptor { | 92 | struct usb_ms_endpoint_descriptor { |
93 | __u8 bLength; // 4+n | 93 | __u8 bLength; /* 4+n */ |
94 | __u8 bDescriptorType; // USB_DT_CS_ENDPOINT | 94 | __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */ |
95 | __u8 bDescriptorSubtype; // USB_MS_GENERAL | 95 | __u8 bDescriptorSubtype; /* USB_MS_GENERAL */ |
96 | __u8 bNumEmbMIDIJack; // n | 96 | __u8 bNumEmbMIDIJack; /* n */ |
97 | __u8 baAssocJackID[]; // [n] | 97 | __u8 baAssocJackID[]; /* [n] */ |
98 | } __attribute__ ((packed)); | 98 | } __attribute__ ((packed)); |
99 | 99 | ||
100 | #define USB_DT_MS_ENDPOINT_SIZE(n) (4 + (n)) | 100 | #define USB_DT_MS_ENDPOINT_SIZE(n) (4 + (n)) |
diff --git a/include/linux/usb/net2280.h b/include/linux/usb/net2280.h index c602f884f182..ec897cb844ab 100644 --- a/include/linux/usb/net2280.h +++ b/include/linux/usb/net2280.h | |||
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | /* main registers, BAR0 + 0x0000 */ | 38 | /* main registers, BAR0 + 0x0000 */ |
39 | struct net2280_regs { | 39 | struct net2280_regs { |
40 | // offset 0x0000 | 40 | /* offset 0x0000 */ |
41 | u32 devinit; | 41 | u32 devinit; |
42 | #define LOCAL_CLOCK_FREQUENCY 8 | 42 | #define LOCAL_CLOCK_FREQUENCY 8 |
43 | #define FORCE_PCI_RESET 7 | 43 | #define FORCE_PCI_RESET 7 |
@@ -61,7 +61,7 @@ struct net2280_regs { | |||
61 | #define EEPROM_WRITE_DATA 0 | 61 | #define EEPROM_WRITE_DATA 0 |
62 | u32 eeclkfreq; | 62 | u32 eeclkfreq; |
63 | u32 _unused0; | 63 | u32 _unused0; |
64 | // offset 0x0010 | 64 | /* offset 0x0010 */ |
65 | 65 | ||
66 | u32 pciirqenb0; /* interrupt PCI master ... */ | 66 | u32 pciirqenb0; /* interrupt PCI master ... */ |
67 | #define SETUP_PACKET_INTERRUPT_ENABLE 7 | 67 | #define SETUP_PACKET_INTERRUPT_ENABLE 7 |
@@ -131,7 +131,7 @@ struct net2280_regs { | |||
131 | #define RESUME_INTERRUPT_ENABLE 1 | 131 | #define RESUME_INTERRUPT_ENABLE 1 |
132 | #define SOF_INTERRUPT_ENABLE 0 | 132 | #define SOF_INTERRUPT_ENABLE 0 |
133 | 133 | ||
134 | // offset 0x0020 | 134 | /* offset 0x0020 */ |
135 | u32 _unused1; | 135 | u32 _unused1; |
136 | u32 usbirqenb1; | 136 | u32 usbirqenb1; |
137 | #define USB_INTERRUPT_ENABLE 31 | 137 | #define USB_INTERRUPT_ENABLE 31 |
@@ -195,7 +195,7 @@ struct net2280_regs { | |||
195 | #define SUSPEND_REQUEST_CHANGE_INTERRUPT 2 | 195 | #define SUSPEND_REQUEST_CHANGE_INTERRUPT 2 |
196 | #define RESUME_INTERRUPT 1 | 196 | #define RESUME_INTERRUPT 1 |
197 | #define SOF_INTERRUPT 0 | 197 | #define SOF_INTERRUPT 0 |
198 | // offset 0x0030 | 198 | /* offset 0x0030 */ |
199 | u32 idxaddr; | 199 | u32 idxaddr; |
200 | u32 idxdata; | 200 | u32 idxdata; |
201 | u32 fifoctl; | 201 | u32 fifoctl; |
@@ -204,7 +204,7 @@ struct net2280_regs { | |||
204 | #define PCI_BASE2_SELECT 2 | 204 | #define PCI_BASE2_SELECT 2 |
205 | #define FIFO_CONFIGURATION_SELECT 0 | 205 | #define FIFO_CONFIGURATION_SELECT 0 |
206 | u32 _unused2; | 206 | u32 _unused2; |
207 | // offset 0x0040 | 207 | /* offset 0x0040 */ |
208 | u32 memaddr; | 208 | u32 memaddr; |
209 | #define START 28 | 209 | #define START 28 |
210 | #define DIRECTION 27 | 210 | #define DIRECTION 27 |
@@ -213,7 +213,7 @@ struct net2280_regs { | |||
213 | u32 memdata0; | 213 | u32 memdata0; |
214 | u32 memdata1; | 214 | u32 memdata1; |
215 | u32 _unused3; | 215 | u32 _unused3; |
216 | // offset 0x0050 | 216 | /* offset 0x0050 */ |
217 | u32 gpioctl; | 217 | u32 gpioctl; |
218 | #define GPIO3_LED_SELECT 12 | 218 | #define GPIO3_LED_SELECT 12 |
219 | #define GPIO3_INTERRUPT_ENABLE 11 | 219 | #define GPIO3_INTERRUPT_ENABLE 11 |
@@ -237,7 +237,7 @@ struct net2280_regs { | |||
237 | 237 | ||
238 | /* usb control, BAR0 + 0x0080 */ | 238 | /* usb control, BAR0 + 0x0080 */ |
239 | struct net2280_usb_regs { | 239 | struct net2280_usb_regs { |
240 | // offset 0x0080 | 240 | /* offset 0x0080 */ |
241 | u32 stdrsp; | 241 | u32 stdrsp; |
242 | #define STALL_UNSUPPORTED_REQUESTS 31 | 242 | #define STALL_UNSUPPORTED_REQUESTS 31 |
243 | #define SET_TEST_MODE 16 | 243 | #define SET_TEST_MODE 16 |
@@ -275,7 +275,7 @@ struct net2280_usb_regs { | |||
275 | #define PME_WAKEUP_ENABLE 2 | 275 | #define PME_WAKEUP_ENABLE 2 |
276 | #define DEVICE_REMOTE_WAKEUP_ENABLE 1 | 276 | #define DEVICE_REMOTE_WAKEUP_ENABLE 1 |
277 | #define SELF_POWERED_STATUS 0 | 277 | #define SELF_POWERED_STATUS 0 |
278 | // offset 0x0090 | 278 | /* offset 0x0090 */ |
279 | u32 usbstat; | 279 | u32 usbstat; |
280 | #define HIGH_SPEED 7 | 280 | #define HIGH_SPEED 7 |
281 | #define FULL_SPEED 6 | 281 | #define FULL_SPEED 6 |
@@ -291,7 +291,7 @@ struct net2280_usb_regs { | |||
291 | #define TERMINATION_SELECT 0 | 291 | #define TERMINATION_SELECT 0 |
292 | u32 setup0123; | 292 | u32 setup0123; |
293 | u32 setup4567; | 293 | u32 setup4567; |
294 | // offset 0x0090 | 294 | /* offset 0x0090 */ |
295 | u32 _unused0; | 295 | u32 _unused0; |
296 | u32 ouraddr; | 296 | u32 ouraddr; |
297 | #define FORCE_IMMEDIATE 7 | 297 | #define FORCE_IMMEDIATE 7 |
@@ -301,7 +301,7 @@ struct net2280_usb_regs { | |||
301 | 301 | ||
302 | /* pci control, BAR0 + 0x0100 */ | 302 | /* pci control, BAR0 + 0x0100 */ |
303 | struct net2280_pci_regs { | 303 | struct net2280_pci_regs { |
304 | // offset 0x0100 | 304 | /* offset 0x0100 */ |
305 | u32 pcimstctl; | 305 | u32 pcimstctl; |
306 | #define PCI_ARBITER_PARK_SELECT 13 | 306 | #define PCI_ARBITER_PARK_SELECT 13 |
307 | #define PCI_MULTI LEVEL_ARBITER 12 | 307 | #define PCI_MULTI LEVEL_ARBITER 12 |
@@ -331,7 +331,7 @@ struct net2280_pci_regs { | |||
331 | * that can be loaded into some of these registers. | 331 | * that can be loaded into some of these registers. |
332 | */ | 332 | */ |
333 | struct net2280_dma_regs { /* [11.7] */ | 333 | struct net2280_dma_regs { /* [11.7] */ |
334 | // offset 0x0180, 0x01a0, 0x01c0, 0x01e0, | 334 | /* offset 0x0180, 0x01a0, 0x01c0, 0x01e0, */ |
335 | u32 dmactl; | 335 | u32 dmactl; |
336 | #define DMA_SCATTER_GATHER_DONE_INTERRUPT_ENABLE 25 | 336 | #define DMA_SCATTER_GATHER_DONE_INTERRUPT_ENABLE 25 |
337 | #define DMA_CLEAR_COUNT_ENABLE 21 | 337 | #define DMA_CLEAR_COUNT_ENABLE 21 |
@@ -355,7 +355,7 @@ struct net2280_dma_regs { /* [11.7] */ | |||
355 | #define DMA_ABORT 1 | 355 | #define DMA_ABORT 1 |
356 | #define DMA_START 0 | 356 | #define DMA_START 0 |
357 | u32 _unused0 [2]; | 357 | u32 _unused0 [2]; |
358 | // offset 0x0190, 0x01b0, 0x01d0, 0x01f0, | 358 | /* offset 0x0190, 0x01b0, 0x01d0, 0x01f0, */ |
359 | u32 dmacount; | 359 | u32 dmacount; |
360 | #define VALID_BIT 31 | 360 | #define VALID_BIT 31 |
361 | #define DMA_DIRECTION 30 | 361 | #define DMA_DIRECTION 30 |
@@ -371,9 +371,9 @@ struct net2280_dma_regs { /* [11.7] */ | |||
371 | /* dedicated endpoint registers, BAR0 + 0x0200 */ | 371 | /* dedicated endpoint registers, BAR0 + 0x0200 */ |
372 | 372 | ||
373 | struct net2280_dep_regs { /* [11.8] */ | 373 | struct net2280_dep_regs { /* [11.8] */ |
374 | // offset 0x0200, 0x0210, 0x220, 0x230, 0x240 | 374 | /* offset 0x0200, 0x0210, 0x220, 0x230, 0x240 */ |
375 | u32 dep_cfg; | 375 | u32 dep_cfg; |
376 | // offset 0x0204, 0x0214, 0x224, 0x234, 0x244 | 376 | /* offset 0x0204, 0x0214, 0x224, 0x234, 0x244 */ |
377 | u32 dep_rsp; | 377 | u32 dep_rsp; |
378 | u32 _unused [2]; | 378 | u32 _unused [2]; |
379 | } __attribute__ ((packed)); | 379 | } __attribute__ ((packed)); |
@@ -383,7 +383,7 @@ struct net2280_dep_regs { /* [11.8] */ | |||
383 | * ep0 reserved for control; E and F have only 64 bytes of fifo | 383 | * ep0 reserved for control; E and F have only 64 bytes of fifo |
384 | */ | 384 | */ |
385 | struct net2280_ep_regs { /* [11.9] */ | 385 | struct net2280_ep_regs { /* [11.9] */ |
386 | // offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0 | 386 | /* offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0 */ |
387 | u32 ep_cfg; | 387 | u32 ep_cfg; |
388 | #define ENDPOINT_BYTE_COUNT 16 | 388 | #define ENDPOINT_BYTE_COUNT 16 |
389 | #define ENDPOINT_ENABLE 10 | 389 | #define ENDPOINT_ENABLE 10 |
@@ -435,7 +435,7 @@ struct net2280_ep_regs { /* [11.9] */ | |||
435 | #define DATA_PACKET_TRANSMITTED_INTERRUPT 2 | 435 | #define DATA_PACKET_TRANSMITTED_INTERRUPT 2 |
436 | #define DATA_OUT_PING_TOKEN_INTERRUPT 1 | 436 | #define DATA_OUT_PING_TOKEN_INTERRUPT 1 |
437 | #define DATA_IN_TOKEN_INTERRUPT 0 | 437 | #define DATA_IN_TOKEN_INTERRUPT 0 |
438 | // offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 | 438 | /* offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 */ |
439 | u32 ep_avail; | 439 | u32 ep_avail; |
440 | u32 ep_data; | 440 | u32 ep_data; |
441 | u32 _unused0 [2]; | 441 | u32 _unused0 [2]; |
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index 9897f7a818c5..e007074ebe41 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h | |||
@@ -1,4 +1,4 @@ | |||
1 | // include/linux/usb/otg.h | 1 | /* USB OTG (On The Go) defines */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * These APIs may be used between USB controllers. USB device drivers | 4 | * These APIs may be used between USB controllers. USB device drivers |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 488ce128885c..21b4a1c6f585 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -20,7 +20,8 @@ | |||
20 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ | 20 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ |
21 | #define SERIAL_TTY_MINORS 255 /* loads of devices :) */ | 21 | #define SERIAL_TTY_MINORS 255 /* loads of devices :) */ |
22 | 22 | ||
23 | #define MAX_NUM_PORTS 8 /* The maximum number of ports one device can grab at once */ | 23 | /* The maximum number of ports one device can grab at once */ |
24 | #define MAX_NUM_PORTS 8 | ||
24 | 25 | ||
25 | /* parity check flag */ | 26 | /* parity check flag */ |
26 | #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) | 27 | #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) |
@@ -61,29 +62,29 @@ | |||
61 | * ports of a device. | 62 | * ports of a device. |
62 | */ | 63 | */ |
63 | struct usb_serial_port { | 64 | struct usb_serial_port { |
64 | struct usb_serial * serial; | 65 | struct usb_serial *serial; |
65 | struct tty_struct * tty; | 66 | struct tty_struct *tty; |
66 | spinlock_t lock; | 67 | spinlock_t lock; |
67 | struct mutex mutex; | 68 | struct mutex mutex; |
68 | unsigned char number; | 69 | unsigned char number; |
69 | 70 | ||
70 | unsigned char * interrupt_in_buffer; | 71 | unsigned char *interrupt_in_buffer; |
71 | struct urb * interrupt_in_urb; | 72 | struct urb *interrupt_in_urb; |
72 | __u8 interrupt_in_endpointAddress; | 73 | __u8 interrupt_in_endpointAddress; |
73 | 74 | ||
74 | unsigned char * interrupt_out_buffer; | 75 | unsigned char *interrupt_out_buffer; |
75 | int interrupt_out_size; | 76 | int interrupt_out_size; |
76 | struct urb * interrupt_out_urb; | 77 | struct urb *interrupt_out_urb; |
77 | __u8 interrupt_out_endpointAddress; | 78 | __u8 interrupt_out_endpointAddress; |
78 | 79 | ||
79 | unsigned char * bulk_in_buffer; | 80 | unsigned char *bulk_in_buffer; |
80 | int bulk_in_size; | 81 | int bulk_in_size; |
81 | struct urb * read_urb; | 82 | struct urb *read_urb; |
82 | __u8 bulk_in_endpointAddress; | 83 | __u8 bulk_in_endpointAddress; |
83 | 84 | ||
84 | unsigned char * bulk_out_buffer; | 85 | unsigned char *bulk_out_buffer; |
85 | int bulk_out_size; | 86 | int bulk_out_size; |
86 | struct urb * write_urb; | 87 | struct urb *write_urb; |
87 | int write_urb_busy; | 88 | int write_urb_busy; |
88 | __u8 bulk_out_endpointAddress; | 89 | __u8 bulk_out_endpointAddress; |
89 | 90 | ||
@@ -92,17 +93,19 @@ struct usb_serial_port { | |||
92 | int open_count; | 93 | int open_count; |
93 | char throttled; | 94 | char throttled; |
94 | char throttle_req; | 95 | char throttle_req; |
96 | char console; | ||
95 | struct device dev; | 97 | struct device dev; |
96 | }; | 98 | }; |
97 | #define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) | 99 | #define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) |
98 | 100 | ||
99 | /* get and set the port private data pointer helper functions */ | 101 | /* get and set the port private data pointer helper functions */ |
100 | static inline void *usb_get_serial_port_data (struct usb_serial_port *port) | 102 | static inline void *usb_get_serial_port_data(struct usb_serial_port *port) |
101 | { | 103 | { |
102 | return dev_get_drvdata(&port->dev); | 104 | return dev_get_drvdata(&port->dev); |
103 | } | 105 | } |
104 | 106 | ||
105 | static inline void usb_set_serial_port_data (struct usb_serial_port *port, void *data) | 107 | static inline void usb_set_serial_port_data(struct usb_serial_port *port, |
108 | void *data) | ||
106 | { | 109 | { |
107 | dev_set_drvdata(&port->dev, data); | 110 | dev_set_drvdata(&port->dev, data); |
108 | } | 111 | } |
@@ -125,9 +128,10 @@ static inline void usb_set_serial_port_data (struct usb_serial_port *port, void | |||
125 | * usb_set_serial_data() to access this. | 128 | * usb_set_serial_data() to access this. |
126 | */ | 129 | */ |
127 | struct usb_serial { | 130 | struct usb_serial { |
128 | struct usb_device * dev; | 131 | struct usb_device *dev; |
129 | struct usb_serial_driver * type; | 132 | struct usb_serial_driver *type; |
130 | struct usb_interface * interface; | 133 | struct usb_interface *interface; |
134 | unsigned char disconnected; | ||
131 | unsigned char minor; | 135 | unsigned char minor; |
132 | unsigned char num_ports; | 136 | unsigned char num_ports; |
133 | unsigned char num_port_pointers; | 137 | unsigned char num_port_pointers; |
@@ -135,29 +139,30 @@ struct usb_serial { | |||
135 | char num_interrupt_out; | 139 | char num_interrupt_out; |
136 | char num_bulk_in; | 140 | char num_bulk_in; |
137 | char num_bulk_out; | 141 | char num_bulk_out; |
138 | struct usb_serial_port * port[MAX_NUM_PORTS]; | 142 | struct usb_serial_port *port[MAX_NUM_PORTS]; |
139 | struct kref kref; | 143 | struct kref kref; |
140 | void * private; | 144 | struct mutex disc_mutex; |
145 | void *private; | ||
141 | }; | 146 | }; |
142 | #define to_usb_serial(d) container_of(d, struct usb_serial, kref) | 147 | #define to_usb_serial(d) container_of(d, struct usb_serial, kref) |
143 | 148 | ||
144 | #define NUM_DONT_CARE 99 | 149 | #define NUM_DONT_CARE 99 |
145 | 150 | ||
146 | /* get and set the serial private data pointer helper functions */ | 151 | /* get and set the serial private data pointer helper functions */ |
147 | static inline void *usb_get_serial_data (struct usb_serial *serial) | 152 | static inline void *usb_get_serial_data(struct usb_serial *serial) |
148 | { | 153 | { |
149 | return serial->private; | 154 | return serial->private; |
150 | } | 155 | } |
151 | 156 | ||
152 | static inline void usb_set_serial_data (struct usb_serial *serial, void *data) | 157 | static inline void usb_set_serial_data(struct usb_serial *serial, void *data) |
153 | { | 158 | { |
154 | serial->private = data; | 159 | serial->private = data; |
155 | } | 160 | } |
156 | 161 | ||
157 | /** | 162 | /** |
158 | * usb_serial_driver - describes a usb serial driver | 163 | * usb_serial_driver - describes a usb serial driver |
159 | * @description: pointer to a string that describes this driver. This string used | 164 | * @description: pointer to a string that describes this driver. This string |
160 | * in the syslog messages when a device is inserted or removed. | 165 | * used in the syslog messages when a device is inserted or removed. |
161 | * @id_table: pointer to a list of usb_device_id structures that define all | 166 | * @id_table: pointer to a list of usb_device_id structures that define all |
162 | * of the devices this structure can support. | 167 | * of the devices this structure can support. |
163 | * @num_interrupt_in: If a device doesn't have this many interrupt-in | 168 | * @num_interrupt_in: If a device doesn't have this many interrupt-in |
@@ -218,82 +223,91 @@ struct usb_serial_driver { | |||
218 | struct usb_driver *usb_driver; | 223 | struct usb_driver *usb_driver; |
219 | struct usb_dynids dynids; | 224 | struct usb_dynids dynids; |
220 | 225 | ||
221 | int (*probe) (struct usb_serial *serial, const struct usb_device_id *id); | 226 | int (*probe)(struct usb_serial *serial, const struct usb_device_id *id); |
222 | int (*attach) (struct usb_serial *serial); | 227 | int (*attach)(struct usb_serial *serial); |
223 | int (*calc_num_ports) (struct usb_serial *serial); | 228 | int (*calc_num_ports) (struct usb_serial *serial); |
224 | 229 | ||
225 | void (*shutdown) (struct usb_serial *serial); | 230 | void (*shutdown)(struct usb_serial *serial); |
226 | 231 | ||
227 | int (*port_probe) (struct usb_serial_port *port); | 232 | int (*port_probe)(struct usb_serial_port *port); |
228 | int (*port_remove) (struct usb_serial_port *port); | 233 | int (*port_remove)(struct usb_serial_port *port); |
229 | 234 | ||
230 | int (*suspend) (struct usb_serial *serial, pm_message_t message); | 235 | int (*suspend)(struct usb_serial *serial, pm_message_t message); |
231 | int (*resume) (struct usb_serial *serial); | 236 | int (*resume)(struct usb_serial *serial); |
232 | 237 | ||
233 | /* serial function calls */ | 238 | /* serial function calls */ |
234 | int (*open) (struct usb_serial_port *port, struct file * filp); | 239 | int (*open)(struct usb_serial_port *port, struct file *filp); |
235 | void (*close) (struct usb_serial_port *port, struct file * filp); | 240 | void (*close)(struct usb_serial_port *port, struct file *filp); |
236 | int (*write) (struct usb_serial_port *port, const unsigned char *buf, int count); | 241 | int (*write)(struct usb_serial_port *port, const unsigned char *buf, |
237 | int (*write_room) (struct usb_serial_port *port); | 242 | int count); |
238 | int (*ioctl) (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg); | 243 | int (*write_room)(struct usb_serial_port *port); |
239 | void (*set_termios) (struct usb_serial_port *port, struct ktermios * old); | 244 | int (*ioctl)(struct usb_serial_port *port, struct file *file, |
240 | void (*break_ctl) (struct usb_serial_port *port, int break_state); | 245 | unsigned int cmd, unsigned long arg); |
241 | int (*chars_in_buffer) (struct usb_serial_port *port); | 246 | void (*set_termios)(struct usb_serial_port *port, struct ktermios *old); |
242 | void (*throttle) (struct usb_serial_port *port); | 247 | void (*break_ctl)(struct usb_serial_port *port, int break_state); |
243 | void (*unthrottle) (struct usb_serial_port *port); | 248 | int (*chars_in_buffer)(struct usb_serial_port *port); |
244 | int (*tiocmget) (struct usb_serial_port *port, struct file *file); | 249 | void (*throttle)(struct usb_serial_port *port); |
245 | int (*tiocmset) (struct usb_serial_port *port, struct file *file, unsigned int set, unsigned int clear); | 250 | void (*unthrottle)(struct usb_serial_port *port); |
251 | int (*tiocmget)(struct usb_serial_port *port, struct file *file); | ||
252 | int (*tiocmset)(struct usb_serial_port *port, struct file *file, | ||
253 | unsigned int set, unsigned int clear); | ||
246 | 254 | ||
247 | void (*read_int_callback)(struct urb *urb); | 255 | void (*read_int_callback)(struct urb *urb); |
248 | void (*write_int_callback)(struct urb *urb); | 256 | void (*write_int_callback)(struct urb *urb); |
249 | void (*read_bulk_callback)(struct urb *urb); | 257 | void (*read_bulk_callback)(struct urb *urb); |
250 | void (*write_bulk_callback)(struct urb *urb); | 258 | void (*write_bulk_callback)(struct urb *urb); |
251 | }; | 259 | }; |
252 | #define to_usb_serial_driver(d) container_of(d, struct usb_serial_driver, driver) | 260 | #define to_usb_serial_driver(d) \ |
261 | container_of(d, struct usb_serial_driver, driver) | ||
253 | 262 | ||
254 | extern int usb_serial_register(struct usb_serial_driver *driver); | 263 | extern int usb_serial_register(struct usb_serial_driver *driver); |
255 | extern void usb_serial_deregister(struct usb_serial_driver *driver); | 264 | extern void usb_serial_deregister(struct usb_serial_driver *driver); |
256 | extern void usb_serial_port_softint(struct usb_serial_port *port); | 265 | extern void usb_serial_port_softint(struct usb_serial_port *port); |
257 | 266 | ||
258 | extern int usb_serial_probe(struct usb_interface *iface, const struct usb_device_id *id); | 267 | extern int usb_serial_probe(struct usb_interface *iface, |
268 | const struct usb_device_id *id); | ||
259 | extern void usb_serial_disconnect(struct usb_interface *iface); | 269 | extern void usb_serial_disconnect(struct usb_interface *iface); |
260 | 270 | ||
261 | extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message); | 271 | extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message); |
262 | extern int usb_serial_resume(struct usb_interface *intf); | 272 | extern int usb_serial_resume(struct usb_interface *intf); |
263 | 273 | ||
264 | extern int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *data, int length, __u8 bRequest); | 274 | extern int ezusb_writememory(struct usb_serial *serial, int address, |
265 | extern int ezusb_set_reset (struct usb_serial *serial, unsigned char reset_bit); | 275 | unsigned char *data, int length, __u8 bRequest); |
276 | extern int ezusb_set_reset(struct usb_serial *serial, unsigned char reset_bit); | ||
266 | 277 | ||
267 | /* USB Serial console functions */ | 278 | /* USB Serial console functions */ |
268 | #ifdef CONFIG_USB_SERIAL_CONSOLE | 279 | #ifdef CONFIG_USB_SERIAL_CONSOLE |
269 | extern void usb_serial_console_init (int debug, int minor); | 280 | extern void usb_serial_console_init(int debug, int minor); |
270 | extern void usb_serial_console_exit (void); | 281 | extern void usb_serial_console_exit(void); |
271 | extern void usb_serial_console_disconnect(struct usb_serial *serial); | 282 | extern void usb_serial_console_disconnect(struct usb_serial *serial); |
272 | #else | 283 | #else |
273 | static inline void usb_serial_console_init (int debug, int minor) { } | 284 | static inline void usb_serial_console_init(int debug, int minor) { } |
274 | static inline void usb_serial_console_exit (void) { } | 285 | static inline void usb_serial_console_exit(void) { } |
275 | static inline void usb_serial_console_disconnect(struct usb_serial *serial) {} | 286 | static inline void usb_serial_console_disconnect(struct usb_serial *serial) {} |
276 | #endif | 287 | #endif |
277 | 288 | ||
278 | /* Functions needed by other parts of the usbserial core */ | 289 | /* Functions needed by other parts of the usbserial core */ |
279 | extern struct usb_serial *usb_serial_get_by_index (unsigned int minor); | 290 | extern struct usb_serial *usb_serial_get_by_index(unsigned int minor); |
280 | extern void usb_serial_put(struct usb_serial *serial); | 291 | extern void usb_serial_put(struct usb_serial *serial); |
281 | extern int usb_serial_generic_open (struct usb_serial_port *port, struct file *filp); | 292 | extern int usb_serial_generic_open(struct usb_serial_port *port, |
282 | extern int usb_serial_generic_write (struct usb_serial_port *port, const unsigned char *buf, int count); | 293 | struct file *filp); |
283 | extern void usb_serial_generic_close (struct usb_serial_port *port, struct file *filp); | 294 | extern int usb_serial_generic_write(struct usb_serial_port *port, |
284 | extern int usb_serial_generic_resume (struct usb_serial *serial); | 295 | const unsigned char *buf, int count); |
285 | extern int usb_serial_generic_write_room (struct usb_serial_port *port); | 296 | extern void usb_serial_generic_close(struct usb_serial_port *port, |
286 | extern int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port); | 297 | struct file *filp); |
287 | extern void usb_serial_generic_read_bulk_callback (struct urb *urb); | 298 | extern int usb_serial_generic_resume(struct usb_serial *serial); |
288 | extern void usb_serial_generic_write_bulk_callback (struct urb *urb); | 299 | extern int usb_serial_generic_write_room(struct usb_serial_port *port); |
289 | extern void usb_serial_generic_throttle (struct usb_serial_port *port); | 300 | extern int usb_serial_generic_chars_in_buffer(struct usb_serial_port *port); |
290 | extern void usb_serial_generic_unthrottle (struct usb_serial_port *port); | 301 | extern void usb_serial_generic_read_bulk_callback(struct urb *urb); |
291 | extern void usb_serial_generic_shutdown (struct usb_serial *serial); | 302 | extern void usb_serial_generic_write_bulk_callback(struct urb *urb); |
292 | extern int usb_serial_generic_register (int debug); | 303 | extern void usb_serial_generic_throttle(struct usb_serial_port *port); |
293 | extern void usb_serial_generic_deregister (void); | 304 | extern void usb_serial_generic_unthrottle(struct usb_serial_port *port); |
294 | 305 | extern void usb_serial_generic_shutdown(struct usb_serial *serial); | |
295 | extern int usb_serial_bus_register (struct usb_serial_driver *device); | 306 | extern int usb_serial_generic_register(int debug); |
296 | extern void usb_serial_bus_deregister (struct usb_serial_driver *device); | 307 | extern void usb_serial_generic_deregister(void); |
308 | |||
309 | extern int usb_serial_bus_register(struct usb_serial_driver *device); | ||
310 | extern void usb_serial_bus_deregister(struct usb_serial_driver *device); | ||
297 | 311 | ||
298 | extern struct usb_serial_driver usb_serial_generic_device; | 312 | extern struct usb_serial_driver usb_serial_generic_device; |
299 | extern struct bus_type usb_serial_bus_type; | 313 | extern struct bus_type usb_serial_bus_type; |
@@ -307,16 +321,22 @@ static inline void usb_serial_debug_data(int debug, | |||
307 | int i; | 321 | int i; |
308 | 322 | ||
309 | if (debug) { | 323 | if (debug) { |
310 | dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ", function, size); | 324 | dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ", |
325 | function, size); | ||
311 | for (i = 0; i < size; ++i) | 326 | for (i = 0; i < size; ++i) |
312 | printk ("%.2x ", data[i]); | 327 | printk("%.2x ", data[i]); |
313 | printk ("\n"); | 328 | printk("\n"); |
314 | } | 329 | } |
315 | } | 330 | } |
316 | 331 | ||
317 | /* Use our own dbg macro */ | 332 | /* Use our own dbg macro */ |
318 | #undef dbg | 333 | #undef dbg |
319 | #define dbg(format, arg...) do { if (debug) printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , ## arg); } while (0) | 334 | #define dbg(format, arg...) \ |
335 | do { \ | ||
336 | if (debug) \ | ||
337 | printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , \ | ||
338 | ## arg); \ | ||
339 | } while (0) | ||
320 | 340 | ||
321 | 341 | ||
322 | 342 | ||
diff --git a/include/linux/usb/sl811.h b/include/linux/usb/sl811.h index 397ee3b3d7f3..877373da410d 100644 --- a/include/linux/usb/sl811.h +++ b/include/linux/usb/sl811.h | |||
@@ -19,8 +19,8 @@ struct sl811_platform_data { | |||
19 | /* pulse sl811 nRST (probably with a GPIO) */ | 19 | /* pulse sl811 nRST (probably with a GPIO) */ |
20 | void (*reset)(struct device *dev); | 20 | void (*reset)(struct device *dev); |
21 | 21 | ||
22 | // some boards need something like these: | 22 | /* some boards need something like these: */ |
23 | // int (*check_overcurrent)(struct device *dev); | 23 | /* int (*check_overcurrent)(struct device *dev); */ |
24 | // void (*clock_enable)(struct device *dev, int is_on); | 24 | /* void (*clock_enable)(struct device *dev, int is_on); */ |
25 | }; | 25 | }; |
26 | 26 | ||
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h index a417b09b8b3d..cee0623b3c7b 100644 --- a/include/linux/usb_usual.h +++ b/include/linux/usb_usual.h | |||
@@ -80,10 +80,9 @@ enum { US_DO_ALL_FLAGS }; | |||
80 | #define US_SC_UFI 0x04 /* Floppy */ | 80 | #define US_SC_UFI 0x04 /* Floppy */ |
81 | #define US_SC_8070 0x05 /* Removable media */ | 81 | #define US_SC_8070 0x05 /* Removable media */ |
82 | #define US_SC_SCSI 0x06 /* Transparent */ | 82 | #define US_SC_SCSI 0x06 /* Transparent */ |
83 | #define US_SC_ISD200 0x07 /* ISD200 ATA */ | 83 | #define US_SC_LOCKABLE 0x07 /* Password-protected */ |
84 | #define US_SC_MIN US_SC_RBC | ||
85 | #define US_SC_MAX US_SC_ISD200 | ||
86 | 84 | ||
85 | #define US_SC_ISD200 0xf0 /* ISD200 ATA */ | ||
87 | #define US_SC_DEVICE 0xff /* Use device's value */ | 86 | #define US_SC_DEVICE 0xff /* Use device's value */ |
88 | 87 | ||
89 | /* Protocols */ | 88 | /* Protocols */ |
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h index 8ca5a7fbc9ec..17cb108b7db0 100644 --- a/include/linux/usbdevice_fs.h +++ b/include/linux/usbdevice_fs.h | |||
@@ -104,7 +104,7 @@ struct usbdevfs_urb { | |||
104 | int error_count; | 104 | int error_count; |
105 | unsigned int signr; /* signal to be sent on completion, | 105 | unsigned int signr; /* signal to be sent on completion, |
106 | or 0 if none should be sent. */ | 106 | or 0 if none should be sent. */ |
107 | void *usercontext; | 107 | void __user *usercontext; |
108 | struct usbdevfs_iso_packet_desc iso_frame_desc[0]; | 108 | struct usbdevfs_iso_packet_desc iso_frame_desc[0]; |
109 | }; | 109 | }; |
110 | 110 | ||