diff options
author | David Brownell <david-b@pacbell.net> | 2005-08-31 12:52:45 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-09-08 19:28:31 -0400 |
commit | 38bde1d4699af45e6a4167a72e2e512e45c35ca8 (patch) | |
tree | 9a133b9c7f7d6d2ecbf99b14a9ce8bfd5b0ceea7 /drivers/usb/net/usbnet.c | |
parent | f29fc259976e9f4dd1fe8ed59ccdd50e4ea61db0 (diff) |
[PATCH] USB: usbnet (2/9) module for simple network links
This patch creates the first of several separate "minidriver" modules
for "usbnet". This one handles only the very simplest hardware, which
can be handled almost entirely by the "usbnet" core.
- Move device-specific bits into new "cdc_subset.c" driver,
shrinking "usbnet" by a bunch;
- Export the functions needed to support this minidriver
(with EXPORT_SYMBOL_GPL);
- Update Kconfig and kbuild accordingly.
This one handles about a dozen different device types, with the most
notable ones being Gumstix and most Linux-based PDAs (except Zaurus
running that ancient code from Sharp).
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/net/usbnet.c')
-rw-r--r-- | drivers/usb/net/usbnet.c | 240 |
1 files changed, 15 insertions, 225 deletions
diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c index 3f2cad6dc261..57b41fbd3bb8 100644 --- a/drivers/usb/net/usbnet.c +++ b/drivers/usb/net/usbnet.c | |||
@@ -322,48 +322,6 @@ static void skb_return (struct usbnet *dev, struct sk_buff *skb) | |||
322 | } | 322 | } |
323 | 323 | ||
324 | 324 | ||
325 | #ifdef CONFIG_USB_ALI_M5632 | ||
326 | #define HAVE_HARDWARE | ||
327 | |||
328 | /*------------------------------------------------------------------------- | ||
329 | * | ||
330 | * ALi M5632 driver ... does high speed | ||
331 | * | ||
332 | *-------------------------------------------------------------------------*/ | ||
333 | |||
334 | static const struct driver_info ali_m5632_info = { | ||
335 | .description = "ALi M5632", | ||
336 | }; | ||
337 | |||
338 | |||
339 | #endif | ||
340 | |||
341 | |||
342 | #ifdef CONFIG_USB_AN2720 | ||
343 | #define HAVE_HARDWARE | ||
344 | |||
345 | /*------------------------------------------------------------------------- | ||
346 | * | ||
347 | * AnchorChips 2720 driver ... http://www.cypress.com | ||
348 | * | ||
349 | * This doesn't seem to have a way to detect whether the peer is | ||
350 | * connected, or need any reset handshaking. It's got pretty big | ||
351 | * internal buffers (handles most of a frame's worth of data). | ||
352 | * Chip data sheets don't describe any vendor control messages. | ||
353 | * | ||
354 | *-------------------------------------------------------------------------*/ | ||
355 | |||
356 | static const struct driver_info an2720_info = { | ||
357 | .description = "AnchorChips/Cypress 2720", | ||
358 | // no reset available! | ||
359 | // no check_connect available! | ||
360 | |||
361 | .in = 2, .out = 2, // direction distinguishes these | ||
362 | }; | ||
363 | |||
364 | #endif /* CONFIG_USB_AN2720 */ | ||
365 | |||
366 | |||
367 | #ifdef CONFIG_USB_AX8817X | 325 | #ifdef CONFIG_USB_AX8817X |
368 | /* ASIX AX8817X based USB 2.0 Ethernet Devices */ | 326 | /* ASIX AX8817X based USB 2.0 Ethernet Devices */ |
369 | 327 | ||
@@ -1142,25 +1100,6 @@ static const struct driver_info ax88772_info = { | |||
1142 | 1100 | ||
1143 | 1101 | ||
1144 | 1102 | ||
1145 | #ifdef CONFIG_USB_BELKIN | ||
1146 | #define HAVE_HARDWARE | ||
1147 | |||
1148 | /*------------------------------------------------------------------------- | ||
1149 | * | ||
1150 | * Belkin F5U104 ... two NetChip 2280 devices + Atmel microcontroller | ||
1151 | * | ||
1152 | * ... also two eTEK designs, including one sold as "Advance USBNET" | ||
1153 | * | ||
1154 | *-------------------------------------------------------------------------*/ | ||
1155 | |||
1156 | static const struct driver_info belkin_info = { | ||
1157 | .description = "Belkin, eTEK, or compatible", | ||
1158 | }; | ||
1159 | |||
1160 | #endif /* CONFIG_USB_BELKIN */ | ||
1161 | |||
1162 | |||
1163 | |||
1164 | /*------------------------------------------------------------------------- | 1103 | /*------------------------------------------------------------------------- |
1165 | * | 1104 | * |
1166 | * Communications Device Class declarations. | 1105 | * Communications Device Class declarations. |
@@ -1538,32 +1477,6 @@ static const struct driver_info cdc_info = { | |||
1538 | 1477 | ||
1539 | 1478 | ||
1540 | 1479 | ||
1541 | #ifdef CONFIG_USB_EPSON2888 | ||
1542 | #define HAVE_HARDWARE | ||
1543 | |||
1544 | /*------------------------------------------------------------------------- | ||
1545 | * | ||
1546 | * EPSON USB clients | ||
1547 | * | ||
1548 | * This is the same idea as Linux PDAs (below) except the firmware in the | ||
1549 | * device might not be Tux-powered. Epson provides reference firmware that | ||
1550 | * implements this interface. Product developers can reuse or modify that | ||
1551 | * code, such as by using their own product and vendor codes. | ||
1552 | * | ||
1553 | * Support was from Juro Bystricky <bystricky.juro@erd.epson.com> | ||
1554 | * | ||
1555 | *-------------------------------------------------------------------------*/ | ||
1556 | |||
1557 | static const struct driver_info epson2888_info = { | ||
1558 | .description = "Epson USB Device", | ||
1559 | .check_connect = always_connected, | ||
1560 | |||
1561 | .in = 4, .out = 3, | ||
1562 | }; | ||
1563 | |||
1564 | #endif /* CONFIG_USB_EPSON2888 */ | ||
1565 | |||
1566 | |||
1567 | #ifdef CONFIG_USB_GENESYS | 1480 | #ifdef CONFIG_USB_GENESYS |
1568 | #define HAVE_HARDWARE | 1481 | #define HAVE_HARDWARE |
1569 | 1482 | ||
@@ -2495,52 +2408,6 @@ static const struct driver_info prolific_info = { | |||
2495 | #endif /* CONFIG_USB_PL2301 */ | 2408 | #endif /* CONFIG_USB_PL2301 */ |
2496 | 2409 | ||
2497 | 2410 | ||
2498 | #ifdef CONFIG_USB_KC2190 | ||
2499 | #define HAVE_HARDWARE | ||
2500 | static const struct driver_info kc2190_info = { | ||
2501 | .description = "KC Technology KC-190", | ||
2502 | }; | ||
2503 | #endif /* CONFIG_USB_KC2190 */ | ||
2504 | |||
2505 | |||
2506 | #ifdef CONFIG_USB_ARMLINUX | ||
2507 | #define HAVE_HARDWARE | ||
2508 | |||
2509 | /*------------------------------------------------------------------------- | ||
2510 | * | ||
2511 | * Intel's SA-1100 chip integrates basic USB support, and is used | ||
2512 | * in PDAs like some iPaqs, the Yopy, some Zaurus models, and more. | ||
2513 | * When they run Linux, arch/arm/mach-sa1100/usb-eth.c may be used to | ||
2514 | * network using minimal USB framing data. | ||
2515 | * | ||
2516 | * This describes the driver currently in standard ARM Linux kernels. | ||
2517 | * The Zaurus uses a different driver (see later). | ||
2518 | * | ||
2519 | * PXA25x and PXA210 use XScale cores (ARM v5TE) with better USB support | ||
2520 | * and different USB endpoint numbering than the SA1100 devices. The | ||
2521 | * mach-pxa/usb-eth.c driver re-uses the device ids from mach-sa1100 | ||
2522 | * so we rely on the endpoint descriptors. | ||
2523 | * | ||
2524 | *-------------------------------------------------------------------------*/ | ||
2525 | |||
2526 | static const struct driver_info linuxdev_info = { | ||
2527 | .description = "Linux Device", | ||
2528 | .check_connect = always_connected, | ||
2529 | }; | ||
2530 | |||
2531 | static const struct driver_info yopy_info = { | ||
2532 | .description = "Yopy", | ||
2533 | .check_connect = always_connected, | ||
2534 | }; | ||
2535 | |||
2536 | static const struct driver_info blob_info = { | ||
2537 | .description = "Boot Loader OBject", | ||
2538 | .check_connect = always_connected, | ||
2539 | }; | ||
2540 | |||
2541 | #endif /* CONFIG_USB_ARMLINUX */ | ||
2542 | |||
2543 | |||
2544 | #ifdef CONFIG_USB_ZAURUS | 2411 | #ifdef CONFIG_USB_ZAURUS |
2545 | #define HAVE_HARDWARE | 2412 | #define HAVE_HARDWARE |
2546 | 2413 | ||
@@ -3575,7 +3442,7 @@ static void usbnet_bh (unsigned long param) | |||
3575 | 3442 | ||
3576 | // precondition: never called in_interrupt | 3443 | // precondition: never called in_interrupt |
3577 | 3444 | ||
3578 | static void usbnet_disconnect (struct usb_interface *intf) | 3445 | void usbnet_disconnect (struct usb_interface *intf) |
3579 | { | 3446 | { |
3580 | struct usbnet *dev; | 3447 | struct usbnet *dev; |
3581 | struct usb_device *xdev; | 3448 | struct usb_device *xdev; |
@@ -3589,7 +3456,8 @@ static void usbnet_disconnect (struct usb_interface *intf) | |||
3589 | xdev = interface_to_usbdev (intf); | 3456 | xdev = interface_to_usbdev (intf); |
3590 | 3457 | ||
3591 | if (netif_msg_probe (dev)) | 3458 | if (netif_msg_probe (dev)) |
3592 | devinfo (dev, "unregister usbnet usb-%s-%s, %s", | 3459 | devinfo (dev, "unregister '%s' usb-%s-%s, %s", |
3460 | intf->dev.driver->name, | ||
3593 | xdev->bus->bus_name, xdev->devpath, | 3461 | xdev->bus->bus_name, xdev->devpath, |
3594 | dev->driver_info->description); | 3462 | dev->driver_info->description); |
3595 | 3463 | ||
@@ -3605,6 +3473,7 @@ static void usbnet_disconnect (struct usb_interface *intf) | |||
3605 | free_netdev(net); | 3473 | free_netdev(net); |
3606 | usb_put_dev (xdev); | 3474 | usb_put_dev (xdev); |
3607 | } | 3475 | } |
3476 | EXPORT_SYMBOL_GPL(usbnet_disconnect); | ||
3608 | 3477 | ||
3609 | 3478 | ||
3610 | /*-------------------------------------------------------------------------*/ | 3479 | /*-------------------------------------------------------------------------*/ |
@@ -3613,7 +3482,7 @@ static struct ethtool_ops usbnet_ethtool_ops; | |||
3613 | 3482 | ||
3614 | // precondition: never called in_interrupt | 3483 | // precondition: never called in_interrupt |
3615 | 3484 | ||
3616 | static int | 3485 | int |
3617 | usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | 3486 | usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) |
3618 | { | 3487 | { |
3619 | struct usbnet *dev; | 3488 | struct usbnet *dev; |
@@ -3719,8 +3588,9 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
3719 | if (status) | 3588 | if (status) |
3720 | goto out3; | 3589 | goto out3; |
3721 | if (netif_msg_probe (dev)) | 3590 | if (netif_msg_probe (dev)) |
3722 | devinfo (dev, "register usbnet at usb-%s-%s, %s, " | 3591 | devinfo (dev, "register '%s' at usb-%s-%s, %s, " |
3723 | "%02x:%02x:%02x:%02x:%02x:%02x", | 3592 | "%02x:%02x:%02x:%02x:%02x:%02x", |
3593 | udev->dev.driver->name, | ||
3724 | xdev->bus->bus_name, xdev->devpath, | 3594 | xdev->bus->bus_name, xdev->devpath, |
3725 | dev->driver_info->description, | 3595 | dev->driver_info->description, |
3726 | net->dev_addr [0], net->dev_addr [1], | 3596 | net->dev_addr [0], net->dev_addr [1], |
@@ -3744,12 +3614,15 @@ out: | |||
3744 | usb_put_dev(xdev); | 3614 | usb_put_dev(xdev); |
3745 | return status; | 3615 | return status; |
3746 | } | 3616 | } |
3617 | EXPORT_SYMBOL_GPL(usbnet_probe); | ||
3747 | 3618 | ||
3748 | /*-------------------------------------------------------------------------*/ | 3619 | /*-------------------------------------------------------------------------*/ |
3749 | 3620 | ||
3750 | #ifdef CONFIG_PM | 3621 | /* FIXME these suspend/resume methods assume non-CDC style |
3622 | * devices, with only one interface. | ||
3623 | */ | ||
3751 | 3624 | ||
3752 | static int usbnet_suspend (struct usb_interface *intf, pm_message_t message) | 3625 | int usbnet_suspend (struct usb_interface *intf, pm_message_t message) |
3753 | { | 3626 | { |
3754 | struct usbnet *dev = usb_get_intfdata(intf); | 3627 | struct usbnet *dev = usb_get_intfdata(intf); |
3755 | 3628 | ||
@@ -3762,8 +3635,9 @@ static int usbnet_suspend (struct usb_interface *intf, pm_message_t message) | |||
3762 | intf->dev.power.power_state = PMSG_SUSPEND; | 3635 | intf->dev.power.power_state = PMSG_SUSPEND; |
3763 | return 0; | 3636 | return 0; |
3764 | } | 3637 | } |
3638 | EXPORT_SYMBOL_GPL(usbnet_suspend); | ||
3765 | 3639 | ||
3766 | static int usbnet_resume (struct usb_interface *intf) | 3640 | int usbnet_resume (struct usb_interface *intf) |
3767 | { | 3641 | { |
3768 | struct usbnet *dev = usb_get_intfdata(intf); | 3642 | struct usbnet *dev = usb_get_intfdata(intf); |
3769 | 3643 | ||
@@ -3772,13 +3646,8 @@ static int usbnet_resume (struct usb_interface *intf) | |||
3772 | tasklet_schedule (&dev->bh); | 3646 | tasklet_schedule (&dev->bh); |
3773 | return 0; | 3647 | return 0; |
3774 | } | 3648 | } |
3649 | EXPORT_SYMBOL_GPL(usbnet_resume); | ||
3775 | 3650 | ||
3776 | #else /* !CONFIG_PM */ | ||
3777 | |||
3778 | #define usbnet_suspend NULL | ||
3779 | #define usbnet_resume NULL | ||
3780 | |||
3781 | #endif /* CONFIG_PM */ | ||
3782 | 3651 | ||
3783 | /*-------------------------------------------------------------------------*/ | 3652 | /*-------------------------------------------------------------------------*/ |
3784 | 3653 | ||
@@ -3793,36 +3662,6 @@ static int usbnet_resume (struct usb_interface *intf) | |||
3793 | 3662 | ||
3794 | static const struct usb_device_id products [] = { | 3663 | static const struct usb_device_id products [] = { |
3795 | 3664 | ||
3796 | #ifdef CONFIG_USB_ALI_M5632 | ||
3797 | { | ||
3798 | USB_DEVICE (0x0402, 0x5632), // ALi defaults | ||
3799 | .driver_info = (unsigned long) &ali_m5632_info, | ||
3800 | }, | ||
3801 | #endif | ||
3802 | |||
3803 | #ifdef CONFIG_USB_AN2720 | ||
3804 | { | ||
3805 | USB_DEVICE (0x0547, 0x2720), // AnchorChips defaults | ||
3806 | .driver_info = (unsigned long) &an2720_info, | ||
3807 | }, { | ||
3808 | USB_DEVICE (0x0547, 0x2727), // Xircom PGUNET | ||
3809 | .driver_info = (unsigned long) &an2720_info, | ||
3810 | }, | ||
3811 | #endif | ||
3812 | |||
3813 | #ifdef CONFIG_USB_BELKIN | ||
3814 | { | ||
3815 | USB_DEVICE (0x050d, 0x0004), // Belkin | ||
3816 | .driver_info = (unsigned long) &belkin_info, | ||
3817 | }, { | ||
3818 | USB_DEVICE (0x056c, 0x8100), // eTEK | ||
3819 | .driver_info = (unsigned long) &belkin_info, | ||
3820 | }, { | ||
3821 | USB_DEVICE (0x0525, 0x9901), // Advance USBNET (eTEK) | ||
3822 | .driver_info = (unsigned long) &belkin_info, | ||
3823 | }, | ||
3824 | #endif | ||
3825 | |||
3826 | #ifdef CONFIG_USB_AX8817X | 3665 | #ifdef CONFIG_USB_AX8817X |
3827 | { | 3666 | { |
3828 | // Linksys USB200M | 3667 | // Linksys USB200M |
@@ -3879,13 +3718,6 @@ static const struct usb_device_id products [] = { | |||
3879 | }, | 3718 | }, |
3880 | #endif | 3719 | #endif |
3881 | 3720 | ||
3882 | #ifdef CONFIG_USB_EPSON2888 | ||
3883 | { | ||
3884 | USB_DEVICE (0x0525, 0x2888), // EPSON USB client | ||
3885 | .driver_info = (unsigned long) &epson2888_info, | ||
3886 | }, | ||
3887 | #endif | ||
3888 | |||
3889 | #ifdef CONFIG_USB_GENESYS | 3721 | #ifdef CONFIG_USB_GENESYS |
3890 | { | 3722 | { |
3891 | USB_DEVICE (0x05e3, 0x0502), // GL620USB-A | 3723 | USB_DEVICE (0x05e3, 0x0502), // GL620USB-A |
@@ -3916,13 +3748,6 @@ static const struct usb_device_id products [] = { | |||
3916 | }, | 3748 | }, |
3917 | #endif | 3749 | #endif |
3918 | 3750 | ||
3919 | #ifdef CONFIG_USB_KC2190 | ||
3920 | { | ||
3921 | USB_DEVICE (0x050f, 0x0190), // KC-190 | ||
3922 | .driver_info = (unsigned long) &kc2190_info, | ||
3923 | }, | ||
3924 | #endif | ||
3925 | |||
3926 | #ifdef CONFIG_USB_RNDIS | 3751 | #ifdef CONFIG_USB_RNDIS |
3927 | { | 3752 | { |
3928 | /* RNDIS is MSFT's un-official variant of CDC ACM */ | 3753 | /* RNDIS is MSFT's un-official variant of CDC ACM */ |
@@ -3931,41 +3756,6 @@ static const struct usb_device_id products [] = { | |||
3931 | }, | 3756 | }, |
3932 | #endif | 3757 | #endif |
3933 | 3758 | ||
3934 | #ifdef CONFIG_USB_ARMLINUX | ||
3935 | /* | ||
3936 | * SA-1100 using standard ARM Linux kernels, or compatible. | ||
3937 | * Often used when talking to Linux PDAs (iPaq, Yopy, etc). | ||
3938 | * The sa-1100 "usb-eth" driver handles the basic framing. | ||
3939 | * | ||
3940 | * PXA25x or PXA210 ... these use a "usb-eth" driver much like | ||
3941 | * the sa1100 one, but hardware uses different endpoint numbers. | ||
3942 | * | ||
3943 | * Or the Linux "Ethernet" gadget on hardware that can't talk | ||
3944 | * CDC Ethernet (e.g., no altsettings), in either of two modes: | ||
3945 | * - acting just like the old "usb-eth" firmware, though | ||
3946 | * the implementation is different | ||
3947 | * - supporting RNDIS as the first/default configuration for | ||
3948 | * MS-Windows interop; Linux needs to use the other config | ||
3949 | */ | ||
3950 | { | ||
3951 | // 1183 = 0x049F, both used as hex values? | ||
3952 | // Compaq "Itsy" vendor/product id | ||
3953 | USB_DEVICE (0x049F, 0x505A), // usb-eth, or compatible | ||
3954 | .driver_info = (unsigned long) &linuxdev_info, | ||
3955 | }, { | ||
3956 | USB_DEVICE (0x0E7E, 0x1001), // G.Mate "Yopy" | ||
3957 | .driver_info = (unsigned long) &yopy_info, | ||
3958 | }, { | ||
3959 | USB_DEVICE (0x8086, 0x07d3), // "blob" bootloader | ||
3960 | .driver_info = (unsigned long) &blob_info, | ||
3961 | }, { | ||
3962 | // Linux Ethernet/RNDIS gadget on pxa210/25x/26x | ||
3963 | // e.g. Gumstix, current OpenZaurus, ... | ||
3964 | USB_DEVICE_VER (0x0525, 0xa4a2, 0x0203, 0x0203), | ||
3965 | .driver_info = (unsigned long) &linuxdev_info, | ||
3966 | }, | ||
3967 | #endif | ||
3968 | |||
3969 | #if defined(CONFIG_USB_ZAURUS) || defined(CONFIG_USB_CDCETHER) | 3759 | #if defined(CONFIG_USB_ZAURUS) || defined(CONFIG_USB_CDCETHER) |
3970 | /* | 3760 | /* |
3971 | * SA-1100 based Sharp Zaurus ("collie"), or compatible. | 3761 | * SA-1100 based Sharp Zaurus ("collie"), or compatible. |