diff options
author | David Vrabel <david.vrabel@csr.com> | 2009-01-02 08:17:13 -0500 |
---|---|---|
committer | David Vrabel <david.vrabel@csr.com> | 2009-01-02 08:17:13 -0500 |
commit | b21a207141d83a06abc5f492b80204602e02ca44 (patch) | |
tree | f0152cde543008c72d7eb5c12c18095ad92785e6 /drivers/usb | |
parent | 3af373021fa32f8f787bfbdcc1a9277a287bde4e (diff) | |
parent | b58602a4bac012b5f4fc12fe6b46ab237b610d5d (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for-upstream
Conflicts:
drivers/uwb/wlp/eda.c
Diffstat (limited to 'drivers/usb')
26 files changed, 794 insertions, 117 deletions
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index 9aea43a8c4ad..5ed4ae07bac1 100644 --- a/drivers/usb/atm/cxacru.c +++ b/drivers/usb/atm/cxacru.c | |||
@@ -286,9 +286,7 @@ static ssize_t cxacru_sysfs_show_mac_address(struct device *dev, | |||
286 | struct usbatm_data *usbatm_instance = usb_get_intfdata(intf); | 286 | struct usbatm_data *usbatm_instance = usb_get_intfdata(intf); |
287 | struct atm_dev *atm_dev = usbatm_instance->atm_dev; | 287 | struct atm_dev *atm_dev = usbatm_instance->atm_dev; |
288 | 288 | ||
289 | return snprintf(buf, PAGE_SIZE, "%02x:%02x:%02x:%02x:%02x:%02x\n", | 289 | return snprintf(buf, PAGE_SIZE, "%pM\n", atm_dev->esi); |
290 | atm_dev->esi[0], atm_dev->esi[1], atm_dev->esi[2], | ||
291 | atm_dev->esi[3], atm_dev->esi[4], atm_dev->esi[5]); | ||
292 | } | 290 | } |
293 | 291 | ||
294 | static ssize_t cxacru_sysfs_show_adsl_state(struct device *dev, | 292 | static ssize_t cxacru_sysfs_show_adsl_state(struct device *dev, |
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c index 06dd114910d4..fbea8563df1e 100644 --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c | |||
@@ -770,10 +770,7 @@ static int usbatm_atm_proc_read(struct atm_dev *atm_dev, loff_t * pos, char *pag | |||
770 | return sprintf(page, "%s\n", instance->description); | 770 | return sprintf(page, "%s\n", instance->description); |
771 | 771 | ||
772 | if (!left--) | 772 | if (!left--) |
773 | return sprintf(page, "MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", | 773 | return sprintf(page, "MAC: %pM\n", atm_dev->esi); |
774 | atm_dev->esi[0], atm_dev->esi[1], | ||
775 | atm_dev->esi[2], atm_dev->esi[3], | ||
776 | atm_dev->esi[4], atm_dev->esi[5]); | ||
777 | 774 | ||
778 | if (!left--) | 775 | if (!left--) |
779 | return sprintf(page, | 776 | return sprintf(page, |
diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index 8e74657f106c..43a863c5cc43 100644 --- a/drivers/usb/class/usbtmc.c +++ b/drivers/usb/class/usbtmc.c | |||
@@ -51,6 +51,7 @@ static struct usb_device_id usbtmc_devices[] = { | |||
51 | { USB_INTERFACE_INFO(USB_CLASS_APP_SPEC, 3, 0), }, | 51 | { USB_INTERFACE_INFO(USB_CLASS_APP_SPEC, 3, 0), }, |
52 | { 0, } /* terminating entry */ | 52 | { 0, } /* terminating entry */ |
53 | }; | 53 | }; |
54 | MODULE_DEVICE_TABLE(usb, usbtmc_devices); | ||
54 | 55 | ||
55 | /* | 56 | /* |
56 | * This structure is the capabilities for the device | 57 | * This structure is the capabilities for the device |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 2bccefebff1b..aa79280df15d 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -574,6 +574,7 @@ static int usbdev_open(struct inode *inode, struct file *file) | |||
574 | { | 574 | { |
575 | struct usb_device *dev = NULL; | 575 | struct usb_device *dev = NULL; |
576 | struct dev_state *ps; | 576 | struct dev_state *ps; |
577 | const struct cred *cred = current_cred(); | ||
577 | int ret; | 578 | int ret; |
578 | 579 | ||
579 | lock_kernel(); | 580 | lock_kernel(); |
@@ -617,8 +618,8 @@ static int usbdev_open(struct inode *inode, struct file *file) | |||
617 | init_waitqueue_head(&ps->wait); | 618 | init_waitqueue_head(&ps->wait); |
618 | ps->discsignr = 0; | 619 | ps->discsignr = 0; |
619 | ps->disc_pid = get_pid(task_pid(current)); | 620 | ps->disc_pid = get_pid(task_pid(current)); |
620 | ps->disc_uid = current->uid; | 621 | ps->disc_uid = cred->uid; |
621 | ps->disc_euid = current->euid; | 622 | ps->disc_euid = cred->euid; |
622 | ps->disccontext = NULL; | 623 | ps->disccontext = NULL; |
623 | ps->ifclaimed = 0; | 624 | ps->ifclaimed = 0; |
624 | security_task_getsecid(current, &ps->secid); | 625 | security_task_getsecid(current, &ps->secid); |
@@ -967,6 +968,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
967 | struct usb_host_endpoint *ep; | 968 | struct usb_host_endpoint *ep; |
968 | struct async *as; | 969 | struct async *as; |
969 | struct usb_ctrlrequest *dr = NULL; | 970 | struct usb_ctrlrequest *dr = NULL; |
971 | const struct cred *cred = current_cred(); | ||
970 | unsigned int u, totlen, isofrmlen; | 972 | unsigned int u, totlen, isofrmlen; |
971 | int ret, ifnum = -1; | 973 | int ret, ifnum = -1; |
972 | int is_in; | 974 | int is_in; |
@@ -1174,8 +1176,8 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1174 | as->signr = uurb->signr; | 1176 | as->signr = uurb->signr; |
1175 | as->ifnum = ifnum; | 1177 | as->ifnum = ifnum; |
1176 | as->pid = get_pid(task_pid(current)); | 1178 | as->pid = get_pid(task_pid(current)); |
1177 | as->uid = current->uid; | 1179 | as->uid = cred->uid; |
1178 | as->euid = current->euid; | 1180 | as->euid = cred->euid; |
1179 | security_task_getsecid(current, &as->secid); | 1181 | security_task_getsecid(current, &as->secid); |
1180 | if (!is_in) { | 1182 | if (!is_in) { |
1181 | if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, | 1183 | if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, |
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 3d7793d93031..8c081308b0e2 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -279,7 +279,9 @@ static int usb_unbind_interface(struct device *dev) | |||
279 | * altsetting means creating new endpoint device entries). | 279 | * altsetting means creating new endpoint device entries). |
280 | * When either of these happens, defer the Set-Interface. | 280 | * When either of these happens, defer the Set-Interface. |
281 | */ | 281 | */ |
282 | if (!error && intf->dev.power.status == DPM_ON) | 282 | if (intf->cur_altsetting->desc.bAlternateSetting == 0) |
283 | ; /* Already in altsetting 0 so skip Set-Interface */ | ||
284 | else if (!error && intf->dev.power.status == DPM_ON) | ||
283 | usb_set_interface(udev, intf->altsetting[0]. | 285 | usb_set_interface(udev, intf->altsetting[0]. |
284 | desc.bInterfaceNumber, 0); | 286 | desc.bInterfaceNumber, 0); |
285 | else | 287 | else |
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index 94632264dccf..185be760833e 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c | |||
@@ -277,8 +277,8 @@ static struct inode *usbfs_get_inode (struct super_block *sb, int mode, dev_t de | |||
277 | 277 | ||
278 | if (inode) { | 278 | if (inode) { |
279 | inode->i_mode = mode; | 279 | inode->i_mode = mode; |
280 | inode->i_uid = current->fsuid; | 280 | inode->i_uid = current_fsuid(); |
281 | inode->i_gid = current->fsgid; | 281 | inode->i_gid = current_fsgid(); |
282 | inode->i_blocks = 0; | 282 | inode->i_blocks = 0; |
283 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 283 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
284 | switch (mode & S_IFMT) { | 284 | switch (mode & S_IFMT) { |
diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c new file mode 100644 index 000000000000..d8fc9b32fe36 --- /dev/null +++ b/drivers/usb/gadget/f_phonet.c | |||
@@ -0,0 +1,621 @@ | |||
1 | /* | ||
2 | * f_phonet.c -- USB CDC Phonet function | ||
3 | * | ||
4 | * Copyright (C) 2007-2008 Nokia Corporation. All rights reserved. | ||
5 | * | ||
6 | * Author: Rémi Denis-Courmont | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * version 2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
20 | * 02110-1301 USA | ||
21 | */ | ||
22 | |||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/device.h> | ||
25 | |||
26 | #include <linux/netdevice.h> | ||
27 | #include <linux/if_ether.h> | ||
28 | #include <linux/if_phonet.h> | ||
29 | #include <linux/if_arp.h> | ||
30 | |||
31 | #include <linux/usb/ch9.h> | ||
32 | #include <linux/usb/cdc.h> | ||
33 | #include <linux/usb/composite.h> | ||
34 | |||
35 | #include "u_phonet.h" | ||
36 | |||
37 | #define PN_MEDIA_USB 0x1B | ||
38 | |||
39 | /*-------------------------------------------------------------------------*/ | ||
40 | |||
41 | struct phonet_port { | ||
42 | struct f_phonet *usb; | ||
43 | spinlock_t lock; | ||
44 | }; | ||
45 | |||
46 | struct f_phonet { | ||
47 | struct usb_function function; | ||
48 | struct net_device *dev; | ||
49 | struct usb_ep *in_ep, *out_ep; | ||
50 | |||
51 | struct usb_request *in_req; | ||
52 | struct usb_request *out_reqv[0]; | ||
53 | }; | ||
54 | |||
55 | static int phonet_rxq_size = 2; | ||
56 | |||
57 | static inline struct f_phonet *func_to_pn(struct usb_function *f) | ||
58 | { | ||
59 | return container_of(f, struct f_phonet, function); | ||
60 | } | ||
61 | |||
62 | /*-------------------------------------------------------------------------*/ | ||
63 | |||
64 | #define USB_CDC_SUBCLASS_PHONET 0xfe | ||
65 | #define USB_CDC_PHONET_TYPE 0xab | ||
66 | |||
67 | static struct usb_interface_descriptor | ||
68 | pn_control_intf_desc = { | ||
69 | .bLength = sizeof pn_control_intf_desc, | ||
70 | .bDescriptorType = USB_DT_INTERFACE, | ||
71 | |||
72 | /* .bInterfaceNumber = DYNAMIC, */ | ||
73 | .bInterfaceClass = USB_CLASS_COMM, | ||
74 | .bInterfaceSubClass = USB_CDC_SUBCLASS_PHONET, | ||
75 | }; | ||
76 | |||
77 | static const struct usb_cdc_header_desc | ||
78 | pn_header_desc = { | ||
79 | .bLength = sizeof pn_header_desc, | ||
80 | .bDescriptorType = USB_DT_CS_INTERFACE, | ||
81 | .bDescriptorSubType = USB_CDC_HEADER_TYPE, | ||
82 | .bcdCDC = __constant_cpu_to_le16(0x0110), | ||
83 | }; | ||
84 | |||
85 | static const struct usb_cdc_header_desc | ||
86 | pn_phonet_desc = { | ||
87 | .bLength = sizeof pn_phonet_desc, | ||
88 | .bDescriptorType = USB_DT_CS_INTERFACE, | ||
89 | .bDescriptorSubType = USB_CDC_PHONET_TYPE, | ||
90 | .bcdCDC = __constant_cpu_to_le16(0x1505), /* ??? */ | ||
91 | }; | ||
92 | |||
93 | static struct usb_cdc_union_desc | ||
94 | pn_union_desc = { | ||
95 | .bLength = sizeof pn_union_desc, | ||
96 | .bDescriptorType = USB_DT_CS_INTERFACE, | ||
97 | .bDescriptorSubType = USB_CDC_UNION_TYPE, | ||
98 | |||
99 | /* .bMasterInterface0 = DYNAMIC, */ | ||
100 | /* .bSlaveInterface0 = DYNAMIC, */ | ||
101 | }; | ||
102 | |||
103 | static struct usb_interface_descriptor | ||
104 | pn_data_nop_intf_desc = { | ||
105 | .bLength = sizeof pn_data_nop_intf_desc, | ||
106 | .bDescriptorType = USB_DT_INTERFACE, | ||
107 | |||
108 | /* .bInterfaceNumber = DYNAMIC, */ | ||
109 | .bAlternateSetting = 0, | ||
110 | .bNumEndpoints = 0, | ||
111 | .bInterfaceClass = USB_CLASS_CDC_DATA, | ||
112 | }; | ||
113 | |||
114 | static struct usb_interface_descriptor | ||
115 | pn_data_intf_desc = { | ||
116 | .bLength = sizeof pn_data_intf_desc, | ||
117 | .bDescriptorType = USB_DT_INTERFACE, | ||
118 | |||
119 | /* .bInterfaceNumber = DYNAMIC, */ | ||
120 | .bAlternateSetting = 1, | ||
121 | .bNumEndpoints = 2, | ||
122 | .bInterfaceClass = USB_CLASS_CDC_DATA, | ||
123 | }; | ||
124 | |||
125 | static struct usb_endpoint_descriptor | ||
126 | pn_fs_sink_desc = { | ||
127 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
128 | .bDescriptorType = USB_DT_ENDPOINT, | ||
129 | |||
130 | .bEndpointAddress = USB_DIR_OUT, | ||
131 | .bmAttributes = USB_ENDPOINT_XFER_BULK, | ||
132 | }; | ||
133 | |||
134 | static struct usb_endpoint_descriptor | ||
135 | pn_hs_sink_desc = { | ||
136 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
137 | .bDescriptorType = USB_DT_ENDPOINT, | ||
138 | |||
139 | .bEndpointAddress = USB_DIR_OUT, | ||
140 | .bmAttributes = USB_ENDPOINT_XFER_BULK, | ||
141 | .wMaxPacketSize = __constant_cpu_to_le16(512), | ||
142 | }; | ||
143 | |||
144 | static struct usb_endpoint_descriptor | ||
145 | pn_fs_source_desc = { | ||
146 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
147 | .bDescriptorType = USB_DT_ENDPOINT, | ||
148 | |||
149 | .bEndpointAddress = USB_DIR_IN, | ||
150 | .bmAttributes = USB_ENDPOINT_XFER_BULK, | ||
151 | }; | ||
152 | |||
153 | static struct usb_endpoint_descriptor | ||
154 | pn_hs_source_desc = { | ||
155 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
156 | .bDescriptorType = USB_DT_ENDPOINT, | ||
157 | |||
158 | .bEndpointAddress = USB_DIR_IN, | ||
159 | .bmAttributes = USB_ENDPOINT_XFER_BULK, | ||
160 | .wMaxPacketSize = __constant_cpu_to_le16(512), | ||
161 | }; | ||
162 | |||
163 | static struct usb_descriptor_header *fs_pn_function[] = { | ||
164 | (struct usb_descriptor_header *) &pn_control_intf_desc, | ||
165 | (struct usb_descriptor_header *) &pn_header_desc, | ||
166 | (struct usb_descriptor_header *) &pn_phonet_desc, | ||
167 | (struct usb_descriptor_header *) &pn_union_desc, | ||
168 | (struct usb_descriptor_header *) &pn_data_nop_intf_desc, | ||
169 | (struct usb_descriptor_header *) &pn_data_intf_desc, | ||
170 | (struct usb_descriptor_header *) &pn_fs_sink_desc, | ||
171 | (struct usb_descriptor_header *) &pn_fs_source_desc, | ||
172 | NULL, | ||
173 | }; | ||
174 | |||
175 | static struct usb_descriptor_header *hs_pn_function[] = { | ||
176 | (struct usb_descriptor_header *) &pn_control_intf_desc, | ||
177 | (struct usb_descriptor_header *) &pn_header_desc, | ||
178 | (struct usb_descriptor_header *) &pn_phonet_desc, | ||
179 | (struct usb_descriptor_header *) &pn_union_desc, | ||
180 | (struct usb_descriptor_header *) &pn_data_nop_intf_desc, | ||
181 | (struct usb_descriptor_header *) &pn_data_intf_desc, | ||
182 | (struct usb_descriptor_header *) &pn_hs_sink_desc, | ||
183 | (struct usb_descriptor_header *) &pn_hs_source_desc, | ||
184 | NULL, | ||
185 | }; | ||
186 | |||
187 | /*-------------------------------------------------------------------------*/ | ||
188 | |||
189 | static int pn_net_open(struct net_device *dev) | ||
190 | { | ||
191 | if (netif_carrier_ok(dev)) | ||
192 | netif_wake_queue(dev); | ||
193 | return 0; | ||
194 | } | ||
195 | |||
196 | static int pn_net_close(struct net_device *dev) | ||
197 | { | ||
198 | netif_stop_queue(dev); | ||
199 | return 0; | ||
200 | } | ||
201 | |||
202 | static void pn_tx_complete(struct usb_ep *ep, struct usb_request *req) | ||
203 | { | ||
204 | struct f_phonet *fp = ep->driver_data; | ||
205 | struct net_device *dev = fp->dev; | ||
206 | struct sk_buff *skb = req->context; | ||
207 | |||
208 | switch (req->status) { | ||
209 | case 0: | ||
210 | dev->stats.tx_packets++; | ||
211 | dev->stats.tx_bytes += skb->len; | ||
212 | break; | ||
213 | |||
214 | case -ESHUTDOWN: /* disconnected */ | ||
215 | case -ECONNRESET: /* disabled */ | ||
216 | dev->stats.tx_aborted_errors++; | ||
217 | default: | ||
218 | dev->stats.tx_errors++; | ||
219 | } | ||
220 | |||
221 | dev_kfree_skb_any(skb); | ||
222 | if (netif_carrier_ok(dev)) | ||
223 | netif_wake_queue(dev); | ||
224 | } | ||
225 | |||
226 | static int pn_net_xmit(struct sk_buff *skb, struct net_device *dev) | ||
227 | { | ||
228 | struct phonet_port *port = netdev_priv(dev); | ||
229 | struct f_phonet *fp; | ||
230 | struct usb_request *req; | ||
231 | unsigned long flags; | ||
232 | |||
233 | if (skb->protocol != htons(ETH_P_PHONET)) | ||
234 | goto out; | ||
235 | |||
236 | spin_lock_irqsave(&port->lock, flags); | ||
237 | fp = port->usb; | ||
238 | if (unlikely(!fp)) /* race with carrier loss */ | ||
239 | goto out_unlock; | ||
240 | |||
241 | req = fp->in_req; | ||
242 | req->buf = skb->data; | ||
243 | req->length = skb->len; | ||
244 | req->complete = pn_tx_complete; | ||
245 | req->zero = 1; | ||
246 | req->context = skb; | ||
247 | |||
248 | if (unlikely(usb_ep_queue(fp->in_ep, req, GFP_ATOMIC))) | ||
249 | goto out_unlock; | ||
250 | |||
251 | netif_stop_queue(dev); | ||
252 | skb = NULL; | ||
253 | |||
254 | out_unlock: | ||
255 | spin_unlock_irqrestore(&port->lock, flags); | ||
256 | out: | ||
257 | if (unlikely(skb)) { | ||
258 | dev_kfree_skb_any(skb); | ||
259 | dev->stats.tx_dropped++; | ||
260 | } | ||
261 | return 0; | ||
262 | } | ||
263 | |||
264 | static int pn_net_mtu(struct net_device *dev, int new_mtu) | ||
265 | { | ||
266 | struct phonet_port *port = netdev_priv(dev); | ||
267 | unsigned long flags; | ||
268 | int err = -EBUSY; | ||
269 | |||
270 | if ((new_mtu < PHONET_MIN_MTU) || (new_mtu > PHONET_MAX_MTU)) | ||
271 | return -EINVAL; | ||
272 | |||
273 | spin_lock_irqsave(&port->lock, flags); | ||
274 | if (!netif_carrier_ok(dev)) { | ||
275 | dev->mtu = new_mtu; | ||
276 | err = 0; | ||
277 | } | ||
278 | spin_unlock_irqrestore(&port->lock, flags); | ||
279 | return err; | ||
280 | } | ||
281 | |||
282 | static void pn_net_setup(struct net_device *dev) | ||
283 | { | ||
284 | dev->features = 0; | ||
285 | dev->type = ARPHRD_PHONET; | ||
286 | dev->flags = IFF_POINTOPOINT | IFF_NOARP; | ||
287 | dev->mtu = PHONET_DEV_MTU; | ||
288 | dev->hard_header_len = 1; | ||
289 | dev->dev_addr[0] = PN_MEDIA_USB; | ||
290 | dev->addr_len = 1; | ||
291 | dev->tx_queue_len = 1; | ||
292 | |||
293 | dev->destructor = free_netdev; | ||
294 | dev->header_ops = &phonet_header_ops; | ||
295 | dev->open = pn_net_open; | ||
296 | dev->stop = pn_net_close; | ||
297 | dev->hard_start_xmit = pn_net_xmit; /* mandatory */ | ||
298 | dev->change_mtu = pn_net_mtu; | ||
299 | } | ||
300 | |||
301 | /*-------------------------------------------------------------------------*/ | ||
302 | |||
303 | /* | ||
304 | * Queue buffer for data from the host | ||
305 | */ | ||
306 | static int | ||
307 | pn_rx_submit(struct f_phonet *fp, struct usb_request *req, gfp_t gfp_flags) | ||
308 | { | ||
309 | struct sk_buff *skb; | ||
310 | const size_t size = fp->dev->mtu; | ||
311 | int err; | ||
312 | |||
313 | skb = alloc_skb(size, gfp_flags); | ||
314 | if (!skb) | ||
315 | return -ENOMEM; | ||
316 | |||
317 | req->buf = skb->data; | ||
318 | req->length = size; | ||
319 | req->context = skb; | ||
320 | |||
321 | err = usb_ep_queue(fp->out_ep, req, gfp_flags); | ||
322 | if (unlikely(err)) | ||
323 | dev_kfree_skb_any(skb); | ||
324 | return err; | ||
325 | } | ||
326 | |||
327 | static void pn_rx_complete(struct usb_ep *ep, struct usb_request *req) | ||
328 | { | ||
329 | struct f_phonet *fp = ep->driver_data; | ||
330 | struct net_device *dev = fp->dev; | ||
331 | struct sk_buff *skb = req->context; | ||
332 | int status = req->status; | ||
333 | |||
334 | switch (status) { | ||
335 | case 0: | ||
336 | if (unlikely(!netif_running(dev))) | ||
337 | break; | ||
338 | if (unlikely(req->actual < 1)) | ||
339 | break; | ||
340 | skb_put(skb, req->actual); | ||
341 | skb->protocol = htons(ETH_P_PHONET); | ||
342 | skb_reset_mac_header(skb); | ||
343 | __skb_pull(skb, 1); | ||
344 | skb->dev = dev; | ||
345 | dev->stats.rx_packets++; | ||
346 | dev->stats.rx_bytes += skb->len; | ||
347 | |||
348 | netif_rx(skb); | ||
349 | skb = NULL; | ||
350 | break; | ||
351 | |||
352 | /* Do not resubmit in these cases: */ | ||
353 | case -ESHUTDOWN: /* disconnect */ | ||
354 | case -ECONNABORTED: /* hw reset */ | ||
355 | case -ECONNRESET: /* dequeued (unlink or netif down) */ | ||
356 | req = NULL; | ||
357 | break; | ||
358 | |||
359 | /* Do resubmit in these cases: */ | ||
360 | case -EOVERFLOW: /* request buffer overflow */ | ||
361 | dev->stats.rx_over_errors++; | ||
362 | default: | ||
363 | dev->stats.rx_errors++; | ||
364 | break; | ||
365 | } | ||
366 | |||
367 | if (skb) | ||
368 | dev_kfree_skb_any(skb); | ||
369 | if (req) | ||
370 | pn_rx_submit(fp, req, GFP_ATOMIC); | ||
371 | } | ||
372 | |||
373 | /*-------------------------------------------------------------------------*/ | ||
374 | |||
375 | static void __pn_reset(struct usb_function *f) | ||
376 | { | ||
377 | struct f_phonet *fp = func_to_pn(f); | ||
378 | struct net_device *dev = fp->dev; | ||
379 | struct phonet_port *port = netdev_priv(dev); | ||
380 | |||
381 | netif_carrier_off(dev); | ||
382 | netif_stop_queue(dev); | ||
383 | port->usb = NULL; | ||
384 | |||
385 | usb_ep_disable(fp->out_ep); | ||
386 | usb_ep_disable(fp->in_ep); | ||
387 | } | ||
388 | |||
389 | static int pn_set_alt(struct usb_function *f, unsigned intf, unsigned alt) | ||
390 | { | ||
391 | struct f_phonet *fp = func_to_pn(f); | ||
392 | struct usb_gadget *gadget = fp->function.config->cdev->gadget; | ||
393 | |||
394 | if (intf == pn_control_intf_desc.bInterfaceNumber) | ||
395 | /* control interface, no altsetting */ | ||
396 | return (alt > 0) ? -EINVAL : 0; | ||
397 | |||
398 | if (intf == pn_data_intf_desc.bInterfaceNumber) { | ||
399 | struct net_device *dev = fp->dev; | ||
400 | struct phonet_port *port = netdev_priv(dev); | ||
401 | |||
402 | /* data intf (0: inactive, 1: active) */ | ||
403 | if (alt > 1) | ||
404 | return -EINVAL; | ||
405 | |||
406 | spin_lock(&port->lock); | ||
407 | __pn_reset(f); | ||
408 | if (alt == 1) { | ||
409 | struct usb_endpoint_descriptor *out, *in; | ||
410 | int i; | ||
411 | |||
412 | out = ep_choose(gadget, | ||
413 | &pn_hs_sink_desc, | ||
414 | &pn_fs_sink_desc); | ||
415 | in = ep_choose(gadget, | ||
416 | &pn_hs_source_desc, | ||
417 | &pn_fs_source_desc); | ||
418 | usb_ep_enable(fp->out_ep, out); | ||
419 | usb_ep_enable(fp->in_ep, in); | ||
420 | |||
421 | port->usb = fp; | ||
422 | fp->out_ep->driver_data = fp; | ||
423 | fp->in_ep->driver_data = fp; | ||
424 | |||
425 | netif_carrier_on(dev); | ||
426 | if (netif_running(dev)) | ||
427 | netif_wake_queue(dev); | ||
428 | for (i = 0; i < phonet_rxq_size; i++) | ||
429 | pn_rx_submit(fp, fp->out_reqv[i], GFP_ATOMIC); | ||
430 | } | ||
431 | spin_unlock(&port->lock); | ||
432 | return 0; | ||
433 | } | ||
434 | |||
435 | return -EINVAL; | ||
436 | } | ||
437 | |||
438 | static int pn_get_alt(struct usb_function *f, unsigned intf) | ||
439 | { | ||
440 | struct f_phonet *fp = func_to_pn(f); | ||
441 | |||
442 | if (intf == pn_control_intf_desc.bInterfaceNumber) | ||
443 | return 0; | ||
444 | |||
445 | if (intf == pn_data_intf_desc.bInterfaceNumber) { | ||
446 | struct phonet_port *port = netdev_priv(fp->dev); | ||
447 | u8 alt; | ||
448 | |||
449 | spin_lock(&port->lock); | ||
450 | alt = port->usb != NULL; | ||
451 | spin_unlock(&port->lock); | ||
452 | return alt; | ||
453 | } | ||
454 | |||
455 | return -EINVAL; | ||
456 | } | ||
457 | |||
458 | static void pn_disconnect(struct usb_function *f) | ||
459 | { | ||
460 | struct f_phonet *fp = func_to_pn(f); | ||
461 | struct phonet_port *port = netdev_priv(fp->dev); | ||
462 | unsigned long flags; | ||
463 | |||
464 | /* remain disabled until set_alt */ | ||
465 | spin_lock_irqsave(&port->lock, flags); | ||
466 | __pn_reset(f); | ||
467 | spin_unlock_irqrestore(&port->lock, flags); | ||
468 | } | ||
469 | |||
470 | /*-------------------------------------------------------------------------*/ | ||
471 | |||
472 | static __init | ||
473 | int pn_bind(struct usb_configuration *c, struct usb_function *f) | ||
474 | { | ||
475 | struct usb_composite_dev *cdev = c->cdev; | ||
476 | struct usb_gadget *gadget = cdev->gadget; | ||
477 | struct f_phonet *fp = func_to_pn(f); | ||
478 | struct usb_ep *ep; | ||
479 | int status, i; | ||
480 | |||
481 | /* Reserve interface IDs */ | ||
482 | status = usb_interface_id(c, f); | ||
483 | if (status < 0) | ||
484 | goto err; | ||
485 | pn_control_intf_desc.bInterfaceNumber = status; | ||
486 | pn_union_desc.bMasterInterface0 = status; | ||
487 | |||
488 | status = usb_interface_id(c, f); | ||
489 | if (status < 0) | ||
490 | goto err; | ||
491 | pn_data_nop_intf_desc.bInterfaceNumber = status; | ||
492 | pn_data_intf_desc.bInterfaceNumber = status; | ||
493 | pn_union_desc.bSlaveInterface0 = status; | ||
494 | |||
495 | /* Reserve endpoints */ | ||
496 | status = -ENODEV; | ||
497 | ep = usb_ep_autoconfig(gadget, &pn_fs_sink_desc); | ||
498 | if (!ep) | ||
499 | goto err; | ||
500 | fp->out_ep = ep; | ||
501 | ep->driver_data = fp; /* Claim */ | ||
502 | |||
503 | ep = usb_ep_autoconfig(gadget, &pn_fs_source_desc); | ||
504 | if (!ep) | ||
505 | goto err; | ||
506 | fp->in_ep = ep; | ||
507 | ep->driver_data = fp; /* Claim */ | ||
508 | |||
509 | pn_hs_sink_desc.bEndpointAddress = | ||
510 | pn_fs_sink_desc.bEndpointAddress; | ||
511 | pn_hs_source_desc.bEndpointAddress = | ||
512 | pn_fs_source_desc.bEndpointAddress; | ||
513 | |||
514 | /* Do not try to bind Phonet twice... */ | ||
515 | fp->function.descriptors = fs_pn_function; | ||
516 | fp->function.hs_descriptors = hs_pn_function; | ||
517 | |||
518 | /* Incoming USB requests */ | ||
519 | status = -ENOMEM; | ||
520 | for (i = 0; i < phonet_rxq_size; i++) { | ||
521 | struct usb_request *req; | ||
522 | |||
523 | req = usb_ep_alloc_request(fp->out_ep, GFP_KERNEL); | ||
524 | if (!req) | ||
525 | goto err; | ||
526 | |||
527 | req->complete = pn_rx_complete; | ||
528 | fp->out_reqv[i] = req; | ||
529 | } | ||
530 | |||
531 | /* Outgoing USB requests */ | ||
532 | fp->in_req = usb_ep_alloc_request(fp->in_ep, GFP_KERNEL); | ||
533 | if (!fp->in_req) | ||
534 | goto err; | ||
535 | |||
536 | INFO(cdev, "USB CDC Phonet function\n"); | ||
537 | INFO(cdev, "using %s, OUT %s, IN %s\n", cdev->gadget->name, | ||
538 | fp->out_ep->name, fp->in_ep->name); | ||
539 | return 0; | ||
540 | |||
541 | err: | ||
542 | if (fp->out_ep) | ||
543 | fp->out_ep->driver_data = NULL; | ||
544 | if (fp->in_ep) | ||
545 | fp->in_ep->driver_data = NULL; | ||
546 | ERROR(cdev, "USB CDC Phonet: cannot autoconfigure\n"); | ||
547 | return status; | ||
548 | } | ||
549 | |||
550 | static void | ||
551 | pn_unbind(struct usb_configuration *c, struct usb_function *f) | ||
552 | { | ||
553 | struct f_phonet *fp = func_to_pn(f); | ||
554 | int i; | ||
555 | |||
556 | /* We are already disconnected */ | ||
557 | if (fp->in_req) | ||
558 | usb_ep_free_request(fp->in_ep, fp->in_req); | ||
559 | for (i = 0; i < phonet_rxq_size; i++) | ||
560 | if (fp->out_reqv[i]) | ||
561 | usb_ep_free_request(fp->out_ep, fp->out_reqv[i]); | ||
562 | |||
563 | kfree(fp); | ||
564 | } | ||
565 | |||
566 | /*-------------------------------------------------------------------------*/ | ||
567 | |||
568 | static struct net_device *dev; | ||
569 | |||
570 | int __init phonet_bind_config(struct usb_configuration *c) | ||
571 | { | ||
572 | struct f_phonet *fp; | ||
573 | int err; | ||
574 | |||
575 | fp = kzalloc(sizeof(*fp), GFP_KERNEL); | ||
576 | if (!fp) | ||
577 | return -ENOMEM; | ||
578 | |||
579 | fp->dev = dev; | ||
580 | fp->function.name = "phonet"; | ||
581 | fp->function.bind = pn_bind; | ||
582 | fp->function.unbind = pn_unbind; | ||
583 | fp->function.set_alt = pn_set_alt; | ||
584 | fp->function.get_alt = pn_get_alt; | ||
585 | fp->function.disable = pn_disconnect; | ||
586 | |||
587 | err = usb_add_function(c, &fp->function); | ||
588 | if (err) | ||
589 | kfree(fp); | ||
590 | return err; | ||
591 | } | ||
592 | |||
593 | int __init gphonet_setup(struct usb_gadget *gadget) | ||
594 | { | ||
595 | struct phonet_port *port; | ||
596 | int err; | ||
597 | |||
598 | /* Create net device */ | ||
599 | BUG_ON(dev); | ||
600 | dev = alloc_netdev(sizeof(*port) | ||
601 | + (phonet_rxq_size * sizeof(struct usb_request *)), | ||
602 | "upnlink%d", pn_net_setup); | ||
603 | if (!dev) | ||
604 | return -ENOMEM; | ||
605 | |||
606 | port = netdev_priv(dev); | ||
607 | spin_lock_init(&port->lock); | ||
608 | netif_carrier_off(dev); | ||
609 | netif_stop_queue(dev); | ||
610 | SET_NETDEV_DEV(dev, &gadget->dev); | ||
611 | |||
612 | err = register_netdev(dev); | ||
613 | if (err) | ||
614 | free_netdev(dev); | ||
615 | return err; | ||
616 | } | ||
617 | |||
618 | void gphonet_cleanup(void) | ||
619 | { | ||
620 | unregister_netdev(dev); | ||
621 | } | ||
diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c index 428b5993575a..3a8bb53fc473 100644 --- a/drivers/usb/gadget/f_rndis.c +++ b/drivers/usb/gadget/f_rndis.c | |||
@@ -651,6 +651,8 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f) | |||
651 | fs_in_desc.bEndpointAddress; | 651 | fs_in_desc.bEndpointAddress; |
652 | hs_out_desc.bEndpointAddress = | 652 | hs_out_desc.bEndpointAddress = |
653 | fs_out_desc.bEndpointAddress; | 653 | fs_out_desc.bEndpointAddress; |
654 | hs_notify_desc.bEndpointAddress = | ||
655 | fs_notify_desc.bEndpointAddress; | ||
654 | 656 | ||
655 | /* copy descriptors, and track endpoint copies */ | 657 | /* copy descriptors, and track endpoint copies */ |
656 | f->hs_descriptors = usb_copy_descriptors(eth_hs_function); | 658 | f->hs_descriptors = usb_copy_descriptors(eth_hs_function); |
@@ -662,6 +664,8 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f) | |||
662 | f->hs_descriptors, &hs_in_desc); | 664 | f->hs_descriptors, &hs_in_desc); |
663 | rndis->hs.out = usb_find_endpoint(eth_hs_function, | 665 | rndis->hs.out = usb_find_endpoint(eth_hs_function, |
664 | f->hs_descriptors, &hs_out_desc); | 666 | f->hs_descriptors, &hs_out_desc); |
667 | rndis->hs.notify = usb_find_endpoint(eth_hs_function, | ||
668 | f->hs_descriptors, &hs_notify_desc); | ||
665 | } | 669 | } |
666 | 670 | ||
667 | rndis->port.open = rndis_open; | 671 | rndis->port.open = rndis_open; |
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c index 77b44fb48f0a..3a8879ec2061 100644 --- a/drivers/usb/gadget/m66592-udc.c +++ b/drivers/usb/gadget/m66592-udc.c | |||
@@ -623,7 +623,6 @@ static void start_ep0(struct m66592_ep *ep, struct m66592_request *req) | |||
623 | #if defined(CONFIG_SUPERH_BUILT_IN_M66592) | 623 | #if defined(CONFIG_SUPERH_BUILT_IN_M66592) |
624 | static void init_controller(struct m66592 *m66592) | 624 | static void init_controller(struct m66592 *m66592) |
625 | { | 625 | { |
626 | usbf_start_clock(); | ||
627 | m66592_bset(m66592, M66592_HSE, M66592_SYSCFG); /* High spd */ | 626 | m66592_bset(m66592, M66592_HSE, M66592_SYSCFG); /* High spd */ |
628 | m66592_bclr(m66592, M66592_USBE, M66592_SYSCFG); | 627 | m66592_bclr(m66592, M66592_USBE, M66592_SYSCFG); |
629 | m66592_bclr(m66592, M66592_DPRPU, M66592_SYSCFG); | 628 | m66592_bclr(m66592, M66592_DPRPU, M66592_SYSCFG); |
@@ -671,9 +670,7 @@ static void init_controller(struct m66592 *m66592) | |||
671 | 670 | ||
672 | static void disable_controller(struct m66592 *m66592) | 671 | static void disable_controller(struct m66592 *m66592) |
673 | { | 672 | { |
674 | #if defined(CONFIG_SUPERH_BUILT_IN_M66592) | 673 | #if !defined(CONFIG_SUPERH_BUILT_IN_M66592) |
675 | usbf_stop_clock(); | ||
676 | #else | ||
677 | m66592_bclr(m66592, M66592_SCKE, M66592_SYSCFG); | 674 | m66592_bclr(m66592, M66592_SCKE, M66592_SYSCFG); |
678 | udelay(1); | 675 | udelay(1); |
679 | m66592_bclr(m66592, M66592_PLLC, M66592_SYSCFG); | 676 | m66592_bclr(m66592, M66592_PLLC, M66592_SYSCFG); |
@@ -686,9 +683,7 @@ static void disable_controller(struct m66592 *m66592) | |||
686 | 683 | ||
687 | static void m66592_start_xclock(struct m66592 *m66592) | 684 | static void m66592_start_xclock(struct m66592 *m66592) |
688 | { | 685 | { |
689 | #if defined(CONFIG_SUPERH_BUILT_IN_M66592) | 686 | #if !defined(CONFIG_SUPERH_BUILT_IN_M66592) |
690 | usbf_start_clock(); | ||
691 | #else | ||
692 | u16 tmp; | 687 | u16 tmp; |
693 | 688 | ||
694 | tmp = m66592_read(m66592, M66592_SYSCFG); | 689 | tmp = m66592_read(m66592, M66592_SYSCFG); |
@@ -1539,7 +1534,10 @@ static int __exit m66592_remove(struct platform_device *pdev) | |||
1539 | iounmap(m66592->reg); | 1534 | iounmap(m66592->reg); |
1540 | free_irq(platform_get_irq(pdev, 0), m66592); | 1535 | free_irq(platform_get_irq(pdev, 0), m66592); |
1541 | m66592_free_request(&m66592->ep[0].ep, m66592->ep0_req); | 1536 | m66592_free_request(&m66592->ep[0].ep, m66592->ep0_req); |
1542 | usbf_stop_clock(); | 1537 | #if defined(CONFIG_SUPERH_BUILT_IN_M66592) && defined(CONFIG_HAVE_CLK) |
1538 | clk_disable(m66592->clk); | ||
1539 | clk_put(m66592->clk); | ||
1540 | #endif | ||
1543 | kfree(m66592); | 1541 | kfree(m66592); |
1544 | return 0; | 1542 | return 0; |
1545 | } | 1543 | } |
@@ -1556,6 +1554,9 @@ static int __init m66592_probe(struct platform_device *pdev) | |||
1556 | int irq; | 1554 | int irq; |
1557 | void __iomem *reg = NULL; | 1555 | void __iomem *reg = NULL; |
1558 | struct m66592 *m66592 = NULL; | 1556 | struct m66592 *m66592 = NULL; |
1557 | #if defined(CONFIG_SUPERH_BUILT_IN_M66592) && defined(CONFIG_HAVE_CLK) | ||
1558 | char clk_name[8]; | ||
1559 | #endif | ||
1559 | int ret = 0; | 1560 | int ret = 0; |
1560 | int i; | 1561 | int i; |
1561 | 1562 | ||
@@ -1614,6 +1615,16 @@ static int __init m66592_probe(struct platform_device *pdev) | |||
1614 | goto clean_up; | 1615 | goto clean_up; |
1615 | } | 1616 | } |
1616 | 1617 | ||
1618 | #if defined(CONFIG_SUPERH_BUILT_IN_M66592) && defined(CONFIG_HAVE_CLK) | ||
1619 | snprintf(clk_name, sizeof(clk_name), "usbf%d", pdev->id); | ||
1620 | m66592->clk = clk_get(&pdev->dev, clk_name); | ||
1621 | if (IS_ERR(m66592->clk)) { | ||
1622 | dev_err(&pdev->dev, "cannot get clock \"%s\"\n", clk_name); | ||
1623 | ret = PTR_ERR(m66592->clk); | ||
1624 | goto clean_up2; | ||
1625 | } | ||
1626 | clk_enable(m66592->clk); | ||
1627 | #endif | ||
1617 | INIT_LIST_HEAD(&m66592->gadget.ep_list); | 1628 | INIT_LIST_HEAD(&m66592->gadget.ep_list); |
1618 | m66592->gadget.ep0 = &m66592->ep[0].ep; | 1629 | m66592->gadget.ep0 = &m66592->ep[0].ep; |
1619 | INIT_LIST_HEAD(&m66592->gadget.ep0->ep_list); | 1630 | INIT_LIST_HEAD(&m66592->gadget.ep0->ep_list); |
@@ -1645,7 +1656,7 @@ static int __init m66592_probe(struct platform_device *pdev) | |||
1645 | 1656 | ||
1646 | m66592->ep0_req = m66592_alloc_request(&m66592->ep[0].ep, GFP_KERNEL); | 1657 | m66592->ep0_req = m66592_alloc_request(&m66592->ep[0].ep, GFP_KERNEL); |
1647 | if (m66592->ep0_req == NULL) | 1658 | if (m66592->ep0_req == NULL) |
1648 | goto clean_up2; | 1659 | goto clean_up3; |
1649 | m66592->ep0_req->complete = nop_completion; | 1660 | m66592->ep0_req->complete = nop_completion; |
1650 | 1661 | ||
1651 | init_controller(m66592); | 1662 | init_controller(m66592); |
@@ -1653,7 +1664,12 @@ static int __init m66592_probe(struct platform_device *pdev) | |||
1653 | dev_info(&pdev->dev, "version %s\n", DRIVER_VERSION); | 1664 | dev_info(&pdev->dev, "version %s\n", DRIVER_VERSION); |
1654 | return 0; | 1665 | return 0; |
1655 | 1666 | ||
1667 | clean_up3: | ||
1668 | #if defined(CONFIG_SUPERH_BUILT_IN_M66592) && defined(CONFIG_HAVE_CLK) | ||
1669 | clk_disable(m66592->clk); | ||
1670 | clk_put(m66592->clk); | ||
1656 | clean_up2: | 1671 | clean_up2: |
1672 | #endif | ||
1657 | free_irq(irq, m66592); | 1673 | free_irq(irq, m66592); |
1658 | clean_up: | 1674 | clean_up: |
1659 | if (m66592) { | 1675 | if (m66592) { |
diff --git a/drivers/usb/gadget/m66592-udc.h b/drivers/usb/gadget/m66592-udc.h index f118f00f1466..286ce07e7960 100644 --- a/drivers/usb/gadget/m66592-udc.h +++ b/drivers/usb/gadget/m66592-udc.h | |||
@@ -23,6 +23,10 @@ | |||
23 | #ifndef __M66592_UDC_H__ | 23 | #ifndef __M66592_UDC_H__ |
24 | #define __M66592_UDC_H__ | 24 | #define __M66592_UDC_H__ |
25 | 25 | ||
26 | #if defined(CONFIG_SUPERH_BUILT_IN_M66592) && defined(CONFIG_HAVE_CLK) | ||
27 | #include <linux/clk.h> | ||
28 | #endif | ||
29 | |||
26 | #define M66592_SYSCFG 0x00 | 30 | #define M66592_SYSCFG 0x00 |
27 | #define M66592_XTAL 0xC000 /* b15-14: Crystal selection */ | 31 | #define M66592_XTAL 0xC000 /* b15-14: Crystal selection */ |
28 | #define M66592_XTAL48 0x8000 /* 48MHz */ | 32 | #define M66592_XTAL48 0x8000 /* 48MHz */ |
@@ -476,6 +480,9 @@ struct m66592_ep { | |||
476 | struct m66592 { | 480 | struct m66592 { |
477 | spinlock_t lock; | 481 | spinlock_t lock; |
478 | void __iomem *reg; | 482 | void __iomem *reg; |
483 | #if defined(CONFIG_SUPERH_BUILT_IN_M66592) && defined(CONFIG_HAVE_CLK) | ||
484 | struct clk *clk; | ||
485 | #endif | ||
479 | 486 | ||
480 | struct usb_gadget gadget; | 487 | struct usb_gadget gadget; |
481 | struct usb_gadget_driver *driver; | 488 | struct usb_gadget_driver *driver; |
@@ -604,26 +611,6 @@ static inline void m66592_mdfy(struct m66592 *m66592, u16 val, u16 pat, | |||
604 | #define m66592_bset(m66592, val, offset) \ | 611 | #define m66592_bset(m66592, val, offset) \ |
605 | m66592_mdfy(m66592, val, 0, offset) | 612 | m66592_mdfy(m66592, val, 0, offset) |
606 | 613 | ||
607 | #if defined(CONFIG_SUPERH_BUILT_IN_M66592) | ||
608 | #include <asm/io.h> | ||
609 | #define MSTPCR2 0xA4150038 /* for SH7722 */ | ||
610 | #define MSTPCR2_USB 0x00000800 | ||
611 | |||
612 | static inline void usbf_start_clock(void) | ||
613 | { | ||
614 | ctrl_outl(ctrl_inl(MSTPCR2) & ~MSTPCR2_USB, MSTPCR2); | ||
615 | } | ||
616 | |||
617 | static inline void usbf_stop_clock(void) | ||
618 | { | ||
619 | ctrl_outl(ctrl_inl(MSTPCR2) | MSTPCR2_USB, MSTPCR2); | ||
620 | } | ||
621 | |||
622 | #else | ||
623 | #define usbf_start_clock(x) | ||
624 | #define usbf_stop_clock(x) | ||
625 | #endif /* if defined(CONFIG_SUPERH_BUILT_IN_M66592) */ | ||
626 | |||
627 | #endif /* ifndef __M66592_UDC_H__ */ | 614 | #endif /* ifndef __M66592_UDC_H__ */ |
628 | 615 | ||
629 | 616 | ||
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c index 2dbc0db0b46c..8c5026be79d4 100644 --- a/drivers/usb/gadget/pxa25x_udc.c +++ b/drivers/usb/gadget/pxa25x_udc.c | |||
@@ -2145,7 +2145,7 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev) | |||
2145 | if (irq < 0) | 2145 | if (irq < 0) |
2146 | return -ENODEV; | 2146 | return -ENODEV; |
2147 | 2147 | ||
2148 | dev->clk = clk_get(&pdev->dev, "UDCCLK"); | 2148 | dev->clk = clk_get(&pdev->dev, NULL); |
2149 | if (IS_ERR(dev->clk)) { | 2149 | if (IS_ERR(dev->clk)) { |
2150 | retval = PTR_ERR(dev->clk); | 2150 | retval = PTR_ERR(dev->clk); |
2151 | goto err_clk; | 2151 | goto err_clk; |
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c index caa37c95802c..944e4ff641df 100644 --- a/drivers/usb/gadget/pxa27x_udc.c +++ b/drivers/usb/gadget/pxa27x_udc.c | |||
@@ -2226,7 +2226,7 @@ static int __init pxa_udc_probe(struct platform_device *pdev) | |||
2226 | udc->dev = &pdev->dev; | 2226 | udc->dev = &pdev->dev; |
2227 | udc->mach = pdev->dev.platform_data; | 2227 | udc->mach = pdev->dev.platform_data; |
2228 | 2228 | ||
2229 | udc->clk = clk_get(&pdev->dev, "UDCCLK"); | 2229 | udc->clk = clk_get(&pdev->dev, NULL); |
2230 | if (IS_ERR(udc->clk)) { | 2230 | if (IS_ERR(udc->clk)) { |
2231 | retval = PTR_ERR(udc->clk); | 2231 | retval = PTR_ERR(udc->clk); |
2232 | goto err_clk; | 2232 | goto err_clk; |
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c index 00ba06b44752..8d8d65165983 100644 --- a/drivers/usb/gadget/s3c2410_udc.c +++ b/drivers/usb/gadget/s3c2410_udc.c | |||
@@ -53,8 +53,8 @@ | |||
53 | #include <mach/hardware.h> | 53 | #include <mach/hardware.h> |
54 | #include <mach/regs-gpio.h> | 54 | #include <mach/regs-gpio.h> |
55 | 55 | ||
56 | #include <asm/plat-s3c24xx/regs-udc.h> | 56 | #include <plat/regs-udc.h> |
57 | #include <asm/plat-s3c24xx/udc.h> | 57 | #include <plat/udc.h> |
58 | 58 | ||
59 | 59 | ||
60 | #include "s3c2410_udc.h" | 60 | #include "s3c2410_udc.h" |
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c index 66948b72bb9b..d9739d52f8f5 100644 --- a/drivers/usb/gadget/u_ether.c +++ b/drivers/usb/gadget/u_ether.c | |||
@@ -146,7 +146,7 @@ static inline int qlen(struct usb_gadget *gadget) | |||
146 | 146 | ||
147 | /* NETWORK DRIVER HOOKUP (to the layer above this driver) */ | 147 | /* NETWORK DRIVER HOOKUP (to the layer above this driver) */ |
148 | 148 | ||
149 | static int eth_change_mtu(struct net_device *net, int new_mtu) | 149 | static int ueth_change_mtu(struct net_device *net, int new_mtu) |
150 | { | 150 | { |
151 | struct eth_dev *dev = netdev_priv(net); | 151 | struct eth_dev *dev = netdev_priv(net); |
152 | unsigned long flags; | 152 | unsigned long flags; |
@@ -764,7 +764,7 @@ int __init gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN]) | |||
764 | if (ethaddr) | 764 | if (ethaddr) |
765 | memcpy(ethaddr, dev->host_mac, ETH_ALEN); | 765 | memcpy(ethaddr, dev->host_mac, ETH_ALEN); |
766 | 766 | ||
767 | net->change_mtu = eth_change_mtu; | 767 | net->change_mtu = ueth_change_mtu; |
768 | net->hard_start_xmit = eth_start_xmit; | 768 | net->hard_start_xmit = eth_start_xmit; |
769 | net->open = eth_open; | 769 | net->open = eth_open; |
770 | net->stop = eth_stop; | 770 | net->stop = eth_stop; |
@@ -787,10 +787,8 @@ int __init gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN]) | |||
787 | dev_dbg(&g->dev, "register_netdev failed, %d\n", status); | 787 | dev_dbg(&g->dev, "register_netdev failed, %d\n", status); |
788 | free_netdev(net); | 788 | free_netdev(net); |
789 | } else { | 789 | } else { |
790 | DECLARE_MAC_BUF(tmp); | 790 | INFO(dev, "MAC %pM\n", net->dev_addr); |
791 | 791 | INFO(dev, "HOST MAC %pM\n", dev->host_mac); | |
792 | INFO(dev, "MAC %s\n", print_mac(tmp, net->dev_addr)); | ||
793 | INFO(dev, "HOST MAC %s\n", print_mac(tmp, dev->host_mac)); | ||
794 | 792 | ||
795 | the_dev = dev; | 793 | the_dev = dev; |
796 | } | 794 | } |
diff --git a/drivers/usb/gadget/u_phonet.h b/drivers/usb/gadget/u_phonet.h new file mode 100644 index 000000000000..09a75259b6cd --- /dev/null +++ b/drivers/usb/gadget/u_phonet.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * u_phonet.h - interface to Phonet | ||
3 | * | ||
4 | * Copyright (C) 2007-2008 by Nokia Corporation | ||
5 | * | ||
6 | * This software is distributed under the terms of the GNU General | ||
7 | * Public License ("GPL") as published by the Free Software Foundation, | ||
8 | * either version 2 of that License or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #ifndef __U_PHONET_H | ||
12 | #define __U_PHONET_H | ||
13 | |||
14 | #include <linux/usb/composite.h> | ||
15 | #include <linux/usb/cdc.h> | ||
16 | |||
17 | int gphonet_setup(struct usb_gadget *gadget); | ||
18 | int phonet_bind_config(struct usb_configuration *c); | ||
19 | void gphonet_cleanup(void); | ||
20 | |||
21 | #endif /* __U_PHONET_H */ | ||
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c index 5416cf969005..9d487908012e 100644 --- a/drivers/usb/host/ehci-orion.c +++ b/drivers/usb/host/ehci-orion.c | |||
@@ -33,8 +33,9 @@ | |||
33 | /* | 33 | /* |
34 | * Implement Orion USB controller specification guidelines | 34 | * Implement Orion USB controller specification guidelines |
35 | */ | 35 | */ |
36 | static void orion_usb_setup(struct usb_hcd *hcd) | 36 | static void orion_usb_phy_v1_setup(struct usb_hcd *hcd) |
37 | { | 37 | { |
38 | /* The below GLs are according to the Orion Errata document */ | ||
38 | /* | 39 | /* |
39 | * Clear interrupt cause and mask | 40 | * Clear interrupt cause and mask |
40 | */ | 41 | */ |
@@ -258,9 +259,19 @@ static int __init ehci_orion_drv_probe(struct platform_device *pdev) | |||
258 | ehci_orion_conf_mbus_windows(hcd, pd->dram); | 259 | ehci_orion_conf_mbus_windows(hcd, pd->dram); |
259 | 260 | ||
260 | /* | 261 | /* |
261 | * setup Orion USB controller | 262 | * setup Orion USB controller. |
262 | */ | 263 | */ |
263 | orion_usb_setup(hcd); | 264 | switch (pd->phy_version) { |
265 | case EHCI_PHY_NA: /* dont change USB phy settings */ | ||
266 | break; | ||
267 | case EHCI_PHY_ORION: | ||
268 | orion_usb_phy_v1_setup(hcd); | ||
269 | break; | ||
270 | case EHCI_PHY_DD: | ||
271 | case EHCI_PHY_KW: | ||
272 | default: | ||
273 | printk(KERN_WARNING "Orion ehci -USB phy version isn't supported.\n"); | ||
274 | } | ||
264 | 275 | ||
265 | err = usb_add_hcd(hcd, irq, IRQF_SHARED | IRQF_DISABLED); | 276 | err = usb_add_hcd(hcd, irq, IRQF_SHARED | IRQF_DISABLED); |
266 | if (err) | 277 | if (err) |
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index 91697bdb399f..4bbddb73abd9 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/jiffies.h> | 18 | #include <linux/jiffies.h> |
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/clk.h> | 20 | #include <linux/clk.h> |
21 | #include <linux/gpio.h> | ||
21 | 22 | ||
22 | #include <mach/hardware.h> | 23 | #include <mach/hardware.h> |
23 | #include <asm/io.h> | 24 | #include <asm/io.h> |
@@ -25,7 +26,6 @@ | |||
25 | 26 | ||
26 | #include <mach/mux.h> | 27 | #include <mach/mux.h> |
27 | #include <mach/irqs.h> | 28 | #include <mach/irqs.h> |
28 | #include <mach/gpio.h> | ||
29 | #include <mach/fpga.h> | 29 | #include <mach/fpga.h> |
30 | #include <mach/usb.h> | 30 | #include <mach/usb.h> |
31 | 31 | ||
@@ -254,8 +254,8 @@ static int ohci_omap_init(struct usb_hcd *hcd) | |||
254 | 254 | ||
255 | /* gpio9 for overcurrent detction */ | 255 | /* gpio9 for overcurrent detction */ |
256 | omap_cfg_reg(W8_1610_GPIO9); | 256 | omap_cfg_reg(W8_1610_GPIO9); |
257 | omap_request_gpio(9); | 257 | gpio_request(9, "OHCI overcurrent"); |
258 | omap_set_gpio_direction(9, 1 /* IN */); | 258 | gpio_direction_input(9); |
259 | 259 | ||
260 | /* for paranoia's sake: disable USB.PUEN */ | 260 | /* for paranoia's sake: disable USB.PUEN */ |
261 | omap_cfg_reg(W4_USB_HIGHZ); | 261 | omap_cfg_reg(W4_USB_HIGHZ); |
@@ -407,7 +407,7 @@ usb_hcd_omap_remove (struct usb_hcd *hcd, struct platform_device *pdev) | |||
407 | put_device(ohci->transceiver->dev); | 407 | put_device(ohci->transceiver->dev); |
408 | } | 408 | } |
409 | if (machine_is_omap_osk()) | 409 | if (machine_is_omap_osk()) |
410 | omap_free_gpio(9); | 410 | gpio_free(9); |
411 | iounmap(hcd->regs); | 411 | iounmap(hcd->regs); |
412 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | 412 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
413 | usb_put_hcd(hcd); | 413 | usb_put_hcd(hcd); |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index e294d430733b..e44dc2cbca24 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -296,7 +296,7 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device | |||
296 | return -ENXIO; | 296 | return -ENXIO; |
297 | } | 297 | } |
298 | 298 | ||
299 | usb_clk = clk_get(&pdev->dev, "USBCLK"); | 299 | usb_clk = clk_get(&pdev->dev, NULL); |
300 | if (IS_ERR(usb_clk)) | 300 | if (IS_ERR(usb_clk)) |
301 | return PTR_ERR(usb_clk); | 301 | return PTR_ERR(usb_clk); |
302 | 302 | ||
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index 2376f24f3c83..c21f14e0666a 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c | |||
@@ -114,6 +114,9 @@ static int r8a66597_clock_enable(struct r8a66597 *r8a66597) | |||
114 | int i = 0; | 114 | int i = 0; |
115 | 115 | ||
116 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) | 116 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) |
117 | #if defined(CONFIG_HAVE_CLK) | ||
118 | clk_enable(r8a66597->clk); | ||
119 | #endif | ||
117 | do { | 120 | do { |
118 | r8a66597_write(r8a66597, SCKE, SYSCFG0); | 121 | r8a66597_write(r8a66597, SCKE, SYSCFG0); |
119 | tmp = r8a66597_read(r8a66597, SYSCFG0); | 122 | tmp = r8a66597_read(r8a66597, SYSCFG0); |
@@ -154,7 +157,11 @@ static void r8a66597_clock_disable(struct r8a66597 *r8a66597) | |||
154 | { | 157 | { |
155 | r8a66597_bclr(r8a66597, SCKE, SYSCFG0); | 158 | r8a66597_bclr(r8a66597, SCKE, SYSCFG0); |
156 | udelay(1); | 159 | udelay(1); |
157 | #if !defined(CONFIG_SUPERH_ON_CHIP_R8A66597) | 160 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) |
161 | #if defined(CONFIG_HAVE_CLK) | ||
162 | clk_disable(r8a66597->clk); | ||
163 | #endif | ||
164 | #else | ||
158 | r8a66597_bclr(r8a66597, PLLC, SYSCFG0); | 165 | r8a66597_bclr(r8a66597, PLLC, SYSCFG0); |
159 | r8a66597_bclr(r8a66597, XCKE, SYSCFG0); | 166 | r8a66597_bclr(r8a66597, XCKE, SYSCFG0); |
160 | r8a66597_bclr(r8a66597, USBE, SYSCFG0); | 167 | r8a66597_bclr(r8a66597, USBE, SYSCFG0); |
@@ -2261,6 +2268,9 @@ static int __init_or_module r8a66597_remove(struct platform_device *pdev) | |||
2261 | del_timer_sync(&r8a66597->rh_timer); | 2268 | del_timer_sync(&r8a66597->rh_timer); |
2262 | usb_remove_hcd(hcd); | 2269 | usb_remove_hcd(hcd); |
2263 | iounmap((void *)r8a66597->reg); | 2270 | iounmap((void *)r8a66597->reg); |
2271 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) && defined(CONFIG_HAVE_CLK) | ||
2272 | clk_put(r8a66597->clk); | ||
2273 | #endif | ||
2264 | usb_put_hcd(hcd); | 2274 | usb_put_hcd(hcd); |
2265 | return 0; | 2275 | return 0; |
2266 | } | 2276 | } |
@@ -2268,6 +2278,9 @@ static int __init_or_module r8a66597_remove(struct platform_device *pdev) | |||
2268 | #define resource_len(r) (((r)->end - (r)->start) + 1) | 2278 | #define resource_len(r) (((r)->end - (r)->start) + 1) |
2269 | static int __init r8a66597_probe(struct platform_device *pdev) | 2279 | static int __init r8a66597_probe(struct platform_device *pdev) |
2270 | { | 2280 | { |
2281 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) && defined(CONFIG_HAVE_CLK) | ||
2282 | char clk_name[8]; | ||
2283 | #endif | ||
2271 | struct resource *res = NULL, *ires; | 2284 | struct resource *res = NULL, *ires; |
2272 | int irq = -1; | 2285 | int irq = -1; |
2273 | void __iomem *reg = NULL; | 2286 | void __iomem *reg = NULL; |
@@ -2320,6 +2333,16 @@ static int __init r8a66597_probe(struct platform_device *pdev) | |||
2320 | memset(r8a66597, 0, sizeof(struct r8a66597)); | 2333 | memset(r8a66597, 0, sizeof(struct r8a66597)); |
2321 | dev_set_drvdata(&pdev->dev, r8a66597); | 2334 | dev_set_drvdata(&pdev->dev, r8a66597); |
2322 | 2335 | ||
2336 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) && defined(CONFIG_HAVE_CLK) | ||
2337 | snprintf(clk_name, sizeof(clk_name), "usb%d", pdev->id); | ||
2338 | r8a66597->clk = clk_get(&pdev->dev, clk_name); | ||
2339 | if (IS_ERR(r8a66597->clk)) { | ||
2340 | dev_err(&pdev->dev, "cannot get clock \"%s\"\n", clk_name); | ||
2341 | ret = PTR_ERR(r8a66597->clk); | ||
2342 | goto clean_up2; | ||
2343 | } | ||
2344 | #endif | ||
2345 | |||
2323 | spin_lock_init(&r8a66597->lock); | 2346 | spin_lock_init(&r8a66597->lock); |
2324 | init_timer(&r8a66597->rh_timer); | 2347 | init_timer(&r8a66597->rh_timer); |
2325 | r8a66597->rh_timer.function = r8a66597_timer; | 2348 | r8a66597->rh_timer.function = r8a66597_timer; |
@@ -2365,11 +2388,18 @@ static int __init r8a66597_probe(struct platform_device *pdev) | |||
2365 | ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | irq_trigger); | 2388 | ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | irq_trigger); |
2366 | if (ret != 0) { | 2389 | if (ret != 0) { |
2367 | dev_err(&pdev->dev, "Failed to add hcd\n"); | 2390 | dev_err(&pdev->dev, "Failed to add hcd\n"); |
2368 | goto clean_up; | 2391 | goto clean_up3; |
2369 | } | 2392 | } |
2370 | 2393 | ||
2371 | return 0; | 2394 | return 0; |
2372 | 2395 | ||
2396 | clean_up3: | ||
2397 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) && defined(CONFIG_HAVE_CLK) | ||
2398 | clk_put(r8a66597->clk); | ||
2399 | clean_up2: | ||
2400 | #endif | ||
2401 | usb_put_hcd(hcd); | ||
2402 | |||
2373 | clean_up: | 2403 | clean_up: |
2374 | if (reg) | 2404 | if (reg) |
2375 | iounmap(reg); | 2405 | iounmap(reg); |
diff --git a/drivers/usb/host/r8a66597.h b/drivers/usb/host/r8a66597.h index 84ee01417315..ecacde4d69b0 100644 --- a/drivers/usb/host/r8a66597.h +++ b/drivers/usb/host/r8a66597.h | |||
@@ -26,6 +26,10 @@ | |||
26 | #ifndef __R8A66597_H__ | 26 | #ifndef __R8A66597_H__ |
27 | #define __R8A66597_H__ | 27 | #define __R8A66597_H__ |
28 | 28 | ||
29 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) && defined(CONFIG_HAVE_CLK) | ||
30 | #include <linux/clk.h> | ||
31 | #endif | ||
32 | |||
29 | #define SYSCFG0 0x00 | 33 | #define SYSCFG0 0x00 |
30 | #define SYSCFG1 0x02 | 34 | #define SYSCFG1 0x02 |
31 | #define SYSSTS0 0x04 | 35 | #define SYSSTS0 0x04 |
@@ -481,7 +485,9 @@ struct r8a66597_root_hub { | |||
481 | struct r8a66597 { | 485 | struct r8a66597 { |
482 | spinlock_t lock; | 486 | spinlock_t lock; |
483 | unsigned long reg; | 487 | unsigned long reg; |
484 | 488 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) && defined(CONFIG_HAVE_CLK) | |
489 | struct clk *clk; | ||
490 | #endif | ||
485 | struct r8a66597_device device0; | 491 | struct r8a66597_device device0; |
486 | struct r8a66597_root_hub root_hub[R8A66597_MAX_ROOT_HUB]; | 492 | struct r8a66597_root_hub root_hub[R8A66597_MAX_ROOT_HUB]; |
487 | struct list_head pipe_queue[R8A66597_MAX_NUM_PIPE]; | 493 | struct list_head pipe_queue[R8A66597_MAX_NUM_PIPE]; |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index aad1359a3eb1..fb6f2933b01b 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -143,6 +143,7 @@ static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = { | |||
143 | static struct usb_device_id id_table_combined [] = { | 143 | static struct usb_device_id id_table_combined [] = { |
144 | { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) }, | 144 | { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) }, |
145 | { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) }, | 145 | { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) }, |
146 | { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) }, | ||
146 | { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_0_PID) }, | 147 | { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_0_PID) }, |
147 | { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_1_PID) }, | 148 | { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_1_PID) }, |
148 | { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_2_PID) }, | 149 | { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_2_PID) }, |
@@ -166,6 +167,7 @@ static struct usb_device_id id_table_combined [] = { | |||
166 | { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_PID) }, | 167 | { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_PID) }, |
167 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, | 168 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, |
168 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, | 169 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, |
170 | { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) }, | ||
169 | { USB_DEVICE(FTDI_VID, FTDI_XF_632_PID) }, | 171 | { USB_DEVICE(FTDI_VID, FTDI_XF_632_PID) }, |
170 | { USB_DEVICE(FTDI_VID, FTDI_XF_634_PID) }, | 172 | { USB_DEVICE(FTDI_VID, FTDI_XF_634_PID) }, |
171 | { USB_DEVICE(FTDI_VID, FTDI_XF_547_PID) }, | 173 | { USB_DEVICE(FTDI_VID, FTDI_XF_547_PID) }, |
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index 07a3992abad2..373ee09975bb 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -40,6 +40,9 @@ | |||
40 | /* AlphaMicro Components AMC-232USB01 device */ | 40 | /* AlphaMicro Components AMC-232USB01 device */ |
41 | #define FTDI_AMC232_PID 0xFF00 /* Product Id */ | 41 | #define FTDI_AMC232_PID 0xFF00 /* Product Id */ |
42 | 42 | ||
43 | /* www.candapter.com Ewert Energy Systems CANdapter device */ | ||
44 | #define FTDI_CANDAPTER_PID 0x9F80 /* Product Id */ | ||
45 | |||
43 | /* SCS HF Radio Modems PID's (http://www.scs-ptc.com) */ | 46 | /* SCS HF Radio Modems PID's (http://www.scs-ptc.com) */ |
44 | /* the VID is the standard ftdi vid (FTDI_VID) */ | 47 | /* the VID is the standard ftdi vid (FTDI_VID) */ |
45 | #define FTDI_SCS_DEVICE_0_PID 0xD010 /* SCS PTC-IIusb */ | 48 | #define FTDI_SCS_DEVICE_0_PID 0xD010 /* SCS PTC-IIusb */ |
@@ -75,6 +78,9 @@ | |||
75 | /* OpenDCC (www.opendcc.de) product id */ | 78 | /* OpenDCC (www.opendcc.de) product id */ |
76 | #define FTDI_OPENDCC_PID 0xBFD8 | 79 | #define FTDI_OPENDCC_PID 0xBFD8 |
77 | 80 | ||
81 | /* Sprog II (Andrew Crosland's SprogII DCC interface) */ | ||
82 | #define FTDI_SPROG_II 0xF0C8 | ||
83 | |||
78 | /* www.crystalfontz.com devices - thanx for providing free devices for evaluation ! */ | 84 | /* www.crystalfontz.com devices - thanx for providing free devices for evaluation ! */ |
79 | /* they use the ftdi chipset for the USB interface and the vendor id is the same */ | 85 | /* they use the ftdi chipset for the USB interface and the vendor id is the same */ |
80 | #define FTDI_XF_632_PID 0xFC08 /* 632: 16x2 Character Display */ | 86 | #define FTDI_XF_632_PID 0xFC08 /* 632: 16x2 Character Display */ |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 491c8857b644..1aed584be5eb 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -91,6 +91,8 @@ static struct usb_device_id id_table [] = { | |||
91 | { USB_DEVICE(WS002IN_VENDOR_ID, WS002IN_PRODUCT_ID) }, | 91 | { USB_DEVICE(WS002IN_VENDOR_ID, WS002IN_PRODUCT_ID) }, |
92 | { USB_DEVICE(COREGA_VENDOR_ID, COREGA_PRODUCT_ID) }, | 92 | { USB_DEVICE(COREGA_VENDOR_ID, COREGA_PRODUCT_ID) }, |
93 | { USB_DEVICE(YCCABLE_VENDOR_ID, YCCABLE_PRODUCT_ID) }, | 93 | { USB_DEVICE(YCCABLE_VENDOR_ID, YCCABLE_PRODUCT_ID) }, |
94 | { USB_DEVICE(SUPERIAL_VENDOR_ID, SUPERIAL_PRODUCT_ID) }, | ||
95 | { USB_DEVICE(HP_VENDOR_ID, HP_LD220_PRODUCT_ID) }, | ||
94 | { } /* Terminating entry */ | 96 | { } /* Terminating entry */ |
95 | }; | 97 | }; |
96 | 98 | ||
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index a3bd039c78e9..54974f446a8c 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -110,3 +110,11 @@ | |||
110 | /* Y.C. Cable U.S.A., Inc - USB to RS-232 */ | 110 | /* Y.C. Cable U.S.A., Inc - USB to RS-232 */ |
111 | #define YCCABLE_VENDOR_ID 0x05ad | 111 | #define YCCABLE_VENDOR_ID 0x05ad |
112 | #define YCCABLE_PRODUCT_ID 0x0fba | 112 | #define YCCABLE_PRODUCT_ID 0x0fba |
113 | |||
114 | /* "Superial" USB - Serial */ | ||
115 | #define SUPERIAL_VENDOR_ID 0x5372 | ||
116 | #define SUPERIAL_PRODUCT_ID 0x2303 | ||
117 | |||
118 | /* Hewlett-Packard LD220-HP POS Pole Display */ | ||
119 | #define HP_VENDOR_ID 0x03f0 | ||
120 | #define HP_LD220_PRODUCT_ID 0x3524 | ||
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 31c42d1cae13..01d0c70d60e9 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -16,56 +16,6 @@ | |||
16 | * For questions or problems with this driver, contact Texas Instruments | 16 | * For questions or problems with this driver, contact Texas Instruments |
17 | * technical support, or Al Borchers <alborchers@steinerpoint.com>, or | 17 | * technical support, or Al Borchers <alborchers@steinerpoint.com>, or |
18 | * Peter Berger <pberger@brimson.com>. | 18 | * Peter Berger <pberger@brimson.com>. |
19 | * | ||
20 | * This driver needs this hotplug script in /etc/hotplug/usb/ti_usb_3410_5052 | ||
21 | * or in /etc/hotplug.d/usb/ti_usb_3410_5052.hotplug to set the device | ||
22 | * configuration. | ||
23 | * | ||
24 | * #!/bin/bash | ||
25 | * | ||
26 | * BOOT_CONFIG=1 | ||
27 | * ACTIVE_CONFIG=2 | ||
28 | * | ||
29 | * if [[ "$ACTION" != "add" ]] | ||
30 | * then | ||
31 | * exit | ||
32 | * fi | ||
33 | * | ||
34 | * CONFIG_PATH=/sys${DEVPATH%/?*}/bConfigurationValue | ||
35 | * | ||
36 | * if [[ 0`cat $CONFIG_PATH` -ne $BOOT_CONFIG ]] | ||
37 | * then | ||
38 | * exit | ||
39 | * fi | ||
40 | * | ||
41 | * PRODUCT=${PRODUCT%/?*} # delete version | ||
42 | * VENDOR_ID=`printf "%d" 0x${PRODUCT%/?*}` | ||
43 | * PRODUCT_ID=`printf "%d" 0x${PRODUCT#*?/}` | ||
44 | * | ||
45 | * PARAM_PATH=/sys/module/ti_usb_3410_5052/parameters | ||
46 | * | ||
47 | * function scan() { | ||
48 | * s=$1 | ||
49 | * shift | ||
50 | * for i | ||
51 | * do | ||
52 | * if [[ $s -eq $i ]] | ||
53 | * then | ||
54 | * return 0 | ||
55 | * fi | ||
56 | * done | ||
57 | * return 1 | ||
58 | * } | ||
59 | * | ||
60 | * IFS=$IFS, | ||
61 | * | ||
62 | * if (scan $VENDOR_ID 1105 `cat $PARAM_PATH/vendor_3410` && | ||
63 | * scan $PRODUCT_ID 13328 `cat $PARAM_PATH/product_3410`) || | ||
64 | * (scan $VENDOR_ID 1105 `cat $PARAM_PATH/vendor_5052` && | ||
65 | * scan $PRODUCT_ID 20562 20818 20570 20575 `cat $PARAM_PATH/product_5052`) | ||
66 | * then | ||
67 | * echo $ACTIVE_CONFIG > $CONFIG_PATH | ||
68 | * fi | ||
69 | */ | 19 | */ |
70 | 20 | ||
71 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
@@ -457,9 +407,10 @@ static int ti_startup(struct usb_serial *serial) | |||
457 | goto free_tdev; | 407 | goto free_tdev; |
458 | } | 408 | } |
459 | 409 | ||
460 | /* the second configuration must be set (in sysfs by hotplug script) */ | 410 | /* the second configuration must be set */ |
461 | if (dev->actconfig->desc.bConfigurationValue == TI_BOOT_CONFIG) { | 411 | if (dev->actconfig->desc.bConfigurationValue == TI_BOOT_CONFIG) { |
462 | status = -ENODEV; | 412 | status = usb_driver_set_configuration(dev, TI_ACTIVE_CONFIG); |
413 | status = status ? status : -ENODEV; | ||
463 | goto free_tdev; | 414 | goto free_tdev; |
464 | } | 415 | } |
465 | 416 | ||
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index e61f2bfc64ad..bfcc1fe82518 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -167,8 +167,22 @@ UNUSUAL_DEV( 0x0421, 0x005d, 0x0001, 0x0600, | |||
167 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 167 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
168 | US_FL_FIX_CAPACITY ), | 168 | US_FL_FIX_CAPACITY ), |
169 | 169 | ||
170 | /* Reported by Ozan Sener <themgzzy@gmail.com> */ | ||
171 | UNUSUAL_DEV( 0x0421, 0x0060, 0x0551, 0x0551, | ||
172 | "Nokia", | ||
173 | "3500c", | ||
174 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
175 | US_FL_FIX_CAPACITY ), | ||
176 | |||
177 | /* Reported by CSECSY Laszlo <boobaa@frugalware.org> */ | ||
178 | UNUSUAL_DEV( 0x0421, 0x0063, 0x0001, 0x0601, | ||
179 | "Nokia", | ||
180 | "Nokia 3109c", | ||
181 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
182 | US_FL_FIX_CAPACITY ), | ||
183 | |||
170 | /* Patch for Nokia 5310 capacity */ | 184 | /* Patch for Nokia 5310 capacity */ |
171 | UNUSUAL_DEV( 0x0421, 0x006a, 0x0000, 0x0591, | 185 | UNUSUAL_DEV( 0x0421, 0x006a, 0x0000, 0x0701, |
172 | "Nokia", | 186 | "Nokia", |
173 | "5310", | 187 | "5310", |
174 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 188 | US_SC_DEVICE, US_PR_DEVICE, NULL, |