USB: fix needless failure under certain conditions
[wandboard.git] / drivers / usb / misc / usb_u132.h
blobdc2e5a31caec3fe2bc96f8394018e3c23d5f73d2
1 /*
2 * Common Header File for the Elan Digital Systems U132 adapter
3 * this file should be included by both the "ftdi-u132" and
4 * the "u132-hcd" modules.
6 * Copyright(C) 2006 Elan Digital Systems Limited
7 *(http://www.elandigitalsystems.com)
9 * Author and Maintainer - Tony Olech - Elan Digital Systems
10 *(tony.olech@elandigitalsystems.com)
12 * This program is free software;you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation, version 2.
17 * The driver was written by Tony Olech(tony.olech@elandigitalsystems.com)
18 * based on various USB client drivers in the 2.6.15 linux kernel
19 * with constant reference to the 3rd Edition of Linux Device Drivers
20 * published by O'Reilly
22 * The U132 adapter is a USB to CardBus adapter specifically designed
23 * for PC cards that contain an OHCI host controller. Typical PC cards
24 * are the Orange Mobile 3G Option GlobeTrotter Fusion card.
26 * The U132 adapter will *NOT *work with PC cards that do not contain
27 * an OHCI controller. A simple way to test whether a PC card has an
28 * OHCI controller as an interface is to insert the PC card directly
29 * into a laptop(or desktop) with a CardBus slot and if "lspci" shows
30 * a new USB controller and "lsusb -v" shows a new OHCI Host Controller
31 * then there is a good chance that the U132 adapter will support the
32 * PC card.(you also need the specific client driver for the PC card)
34 * Please inform the Author and Maintainer about any PC cards that
35 * contain OHCI Host Controller and work when directly connected to
36 * an embedded CardBus slot but do not work when they are connected
37 * via an ELAN U132 adapter.
39 * The driver consists of two modules, the "ftdi-u132" module is
40 * a USB client driver that interfaces to the FTDI chip within
41 * the U132 adapter manufactured by Elan Digital Systems, and the
42 * "u132-hcd" module is a USB host controller driver that talks
43 * to the OHCI controller within CardBus card that are inserted
44 * in the U132 adapter.
46 * The "ftdi-u132" module should be loaded automatically by the
47 * hot plug system when the U132 adapter is plugged in. The module
48 * initialises the adapter which mostly consists of synchronising
49 * the FTDI chip, before continuously polling the adapter to detect
50 * PC card insertions. As soon as a PC card containing a recognised
51 * OHCI controller is seen the "ftdi-u132" module explicitly requests
52 * the kernel to load the "u132-hcd" module.
54 * The "ftdi-u132" module provides the interface to the inserted
55 * PC card and the "u132-hcd" module uses the API to send and receive
56 * data. The API features call-backs, so that part of the "u132-hcd"
57 * module code will run in the context of one of the kernel threads
58 * of the "ftdi-u132" module.
61 int ftdi_elan_switch_on_diagnostics(int number);
62 void ftdi_elan_gone_away(struct platform_device *pdev);
63 void start_usb_lock_device_tracing(void);
64 struct u132_platform_data {
65 u16 vendor;
66 u16 device;
67 u8 potpg;
68 void (*port_power) (struct device *dev, int is_on);
69 void (*reset) (struct device *dev);
71 int usb_ftdi_elan_edset_single(struct platform_device *pdev, u8 ed_number,
72 void *endp, struct urb *urb, u8 address, u8 ep_number, u8 toggle_bits,
73 void (*callback) (void *endp, struct urb *urb, u8 *buf, int len,
74 int toggle_bits, int error_count, int condition_code, int repeat_number,
75 int halted, int skipped, int actual, int non_null));
76 int usb_ftdi_elan_edset_output(struct platform_device *pdev, u8 ed_number,
77 void *endp, struct urb *urb, u8 address, u8 ep_number, u8 toggle_bits,
78 void (*callback) (void *endp, struct urb *urb, u8 *buf, int len,
79 int toggle_bits, int error_count, int condition_code, int repeat_number,
80 int halted, int skipped, int actual, int non_null));
81 int usb_ftdi_elan_edset_empty(struct platform_device *pdev, u8 ed_number,
82 void *endp, struct urb *urb, u8 address, u8 ep_number, u8 toggle_bits,
83 void (*callback) (void *endp, struct urb *urb, u8 *buf, int len,
84 int toggle_bits, int error_count, int condition_code, int repeat_number,
85 int halted, int skipped, int actual, int non_null));
86 int usb_ftdi_elan_edset_input(struct platform_device *pdev, u8 ed_number,
87 void *endp, struct urb *urb, u8 address, u8 ep_number, u8 toggle_bits,
88 void (*callback) (void *endp, struct urb *urb, u8 *buf, int len,
89 int toggle_bits, int error_count, int condition_code, int repeat_number,
90 int halted, int skipped, int actual, int non_null));
91 int usb_ftdi_elan_edset_setup(struct platform_device *pdev, u8 ed_number,
92 void *endp, struct urb *urb, u8 address, u8 ep_number, u8 toggle_bits,
93 void (*callback) (void *endp, struct urb *urb, u8 *buf, int len,
94 int toggle_bits, int error_count, int condition_code, int repeat_number,
95 int halted, int skipped, int actual, int non_null));
96 int usb_ftdi_elan_edset_flush(struct platform_device *pdev, u8 ed_number,
97 void *endp);
98 int usb_ftdi_elan_read_pcimem(struct platform_device *pdev, int mem_offset,
99 u8 width, u32 *data);
100 int usb_ftdi_elan_write_pcimem(struct platform_device *pdev, int mem_offset,
101 u8 width, u32 data);