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