blob: 7bf4d8686adcf3889f388b5f3691fc88b07216fb [file] [log] [blame]
Pavankumar Kondetif35ab2a2013-11-08 20:16:57 +05301Introduction
2============
3
4This feature requires supporting Mass Storage and Integrated Circuit Card
5interfaces exposed by the UICC (Universal Integrated Circuit Card) device.
6The MSM acts as a USB host and UICC acts as a peripheral. The UICC device
7that is used here is also referred to as Mega-SIM. This feature will be
8supported on MSM8x26.
9
10Hardware description
11====================
12
13The USB3503 HSIC (High Speed Inter Chip) hub's down stream port is modified
14to support Inter-Chip USB for connecting the UICC device. The USB3503 is
15connected to MSM via HSIC interface. The UICC device operates in Full Speed
16mode.
17
18The UICC device will support CCID (Integrated Circuit Card interface Device)
19specification. This interface supports 1 Bulk In, 1 Bulk Out and 1 Interrupt
20endpoint. The Interrupt endpoint is used by the device to send asynchronous
21notifications like card insertion/removal and hardware error events.
22The Bulk endpoints are used for the data communication.
23
24The UICC device will support the Mass Storage Bulk Only 1.0 specification.
25It supports SCSI Transparent subclass '06', corresponding to support of the
26SCSI Primary Command set. It implements SCSI Peripheral Device Type '00'
27(TYPE_DISK) corresponding to a direct access SCSI block device.
28
29Software description
30====================
31
32The MSM HSIC controller driver(drivers/usb/host/ehci-msm-hsic.c) takes care
33of HSIC PHY and link management. The USB3503 HSIC hub is managed by the SMSC
34hub driver(drivers/misc/smsc_hubc.c). Both these drivers are well tested on
35APQ8074 dragon board and are re-used to support this feature.
36
37The mass storage interface is managed by the standard Linux USB storage driver.
38This driver interfaces with SCSI and block layers to export the disk to
39user space.
40
41A new USB driver is implemented to manage the CCID interface. This driver is
42referred to as USB CCID driver in this document. This driver is implemented
43as a pass-through module and provides the character device interface to
44user space. The CCID specification is implemented in the user space.
45
46The CCID command and responses are exchanged over the Bulk endpoints. The
47user space application uses write() and read() calls to send commands and
48receive responses.
49
50The CCID class specific requests are sent over the control endpoint. As
51control requests have a specific format, ioctls are implemented.
52
53The UICC device sends asynchronous notifications over the interrupt endpoint.
54The card insertion/removal and hardware error events are sent to user space
55via an ioctl().
56
57Design Goals:
58============
59
601. Re-use the existing services available in user space. This is achieved
61by implementing the kernel USB CCID driver as a pass-through module.
62
632. Support runtime card insertion/removal.
64
653. Support runtime power management.
66
674. Support Multiple card configuration. More than 1 IC can be connected to
68the USB UICC device.
69
70Power Management
71================
72
73The USB core uses the runtime PM framework to auto suspend the USB devices that
74are not in use. The Auto-suspend is forbidden for all devices except hub class
75devices. The USB CCID driver enables auto-suspend for the UICC device.
76
77An USB device can be suspended only when all of its interfaces are suspended.
78The USB storage interface device acts as a parent device to the underlying
79SCSI host, target and block devices. Runtime PM must be enabled for the
80SCSI device to allow USB storage interface suspend. The SCSI device runtime
81suspend and auto-suspend timeout will be configured from user space via sysfs
82files.
83
84The HSIC platform device and USB3503 HUB device will be runtime suspended
85only after the USB UICC device is suspended.
86
87SMP/multi-core
88==============
89
90The USB CCID driver does not allow multiple clients to open the device file
91concurrently. -EBUSY will be returned if open() is attempted when the
92file is already opened.
93
94The write() and read() methods are implemented synchronously. If another
95write() is called when a previous write() is in progress, -EBUSY is
96returned. The same is applicable to read().
97
98Mutexes will be used to prevent concurrent open(), read() and write() access.
99
100Interface
101=========
102
103A character device file (/dev/ccid_bridge) will be exposed by the USB CCID
104driver. open(), read(), write(), ioctl() and close() methods are implemented.
105This device node is accessible only to the root by default. User space init
106or udev scripts should change the permissions of this device file if it needs
107to be accessed by non-root applications.
108
109open(): The open() is blocked until the UICC device is detected and the CCID
110interface probe is completed. Returns the appropriate error code in case of
111failure.
112
113read(): An URB is submitted on the Bulk In endpoint. The read() is blocked
114until the URB is completed and the data is copied to the user space buffer
115upon success. An appropriate error code is returned in case of failure.
116-ENODEV must be treated as a serious error and no further I/O will be
117attempted.
118
119write(): An URB is submitted on the Bulk Out endpoint. The write() is blocked
120until the URB is completed. An appropriate error code is returned in case of
121failure. -ENODEV must be treated as a serious error and no further I/O will be
122attempted.
123
124ioctl(): The ioctl() method is required for facilitating Control transfers and
125Interrupt transfers.
126
127USB_CCID_GET_CLASS_DESC: This read-only ioctl returns the smart card class
128descriptor as described in the 5.1 section of USB smart card class spec.
129
130USB_CCID_ABORT: This write-only ioctl sends A ABORT class specific request on
131control endpoint. The class request details are mentioned in section 5.3.1.
132
133USB_CCID_GET_CLOCK_FREQUENCIES: This read and write ioctl returns the clock
134frequencies supported by the CCID device. A GET_CLOCK_FREQUENCIES class request
135is sent on the control endpoint. The class request details are mentioned in
136section 5.3.2.
137
138USB_CCID_GET_DATA_RATES: This read and write ioctl returns the data rates
139supported by the CCID device. A GET_DATA_RATES class request is sent on the
140control endpoint. The class request details are mentioned in section 5.3.3.
141
142USB_CCID_GET_EVENT: This read-only ioctl returns the asynchronous event sent
143by the UICC device. The ioctl() is blocked until such event is received from
144the UICC device. This ioctl() returns -ENOENT error code when the device
145does not have an interrupt endpoint and does not support remote wakeup
146capability.
147
148close(): Cancels any ongoing I/O before it returns.
149
150Config options
151==============
152
153Turn on USB_EHCI_MSM_HSIC, USB_HSIC_SMSC_HUB and USB_CCID_BRIDGE configs to
154enable this feature.
155
156References
157==========
158
159Specification for Integrated Circuit(s) Cards Interface Devices
160
161Smart Cards; UICC-Terminal interface; Physical and logical characteristics