From: Lukasz Dalek <luk0104@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 6/6] usbether: Removed DEV_CONFIG_{CDC,SUBSET}
Date: Sun, 23 Sep 2012 16:35:36 +0200 [thread overview]
Message-ID: <1348410936-335-7-git-send-email-luk0104@gmail.com> (raw)
In-Reply-To: <1348410936-335-1-git-send-email-luk0104@gmail.com>
Removed DEV_CONFIG_CDC and DEV_CONFIG_SUBSET and replaced it with
CONFIG_USB_ETH_CDC and CONFIG_USB_ETH_SUBSET.
Signed-off-by: Lukasz Dalek <luk0104@gmail.com>
---
drivers/usb/gadget/ether.c | 75 +++++++++++++++++--------------------------
1 files changed, 30 insertions(+), 45 deletions(-)
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 7e6491d..1e187e5 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -44,21 +44,6 @@ extern struct platform_data brd;
unsigned packet_received, packet_sent;
-#undef DEV_CONFIG_CDC
-#undef DEV_CONFIG_SUBSET
-
-#if !defined(CONFIG_USB_ETH_CDC) && !defined(CONFIG_USB_ETH_SUBSET)
-# define DEV_CONFIG_CDC 1 /* preserve default behavior */
-#endif
-
-#if defined(CONFIG_USB_ETH_CDC)
-# define DEV_CONFIG_CDC 1
-#endif
-
-#if defined(CONFIG_USB_ETH_SUBSET)
-# define DEV_CONFIG_SUBSET 1
-#endif
-
#define GFP_ATOMIC ((gfp_t) 0)
#define GFP_KERNEL ((gfp_t) 0)
@@ -174,9 +159,9 @@ static struct usb_gadget_driver eth_driver;
/* "main" config is either CDC, or its simple subset */
static inline int is_cdc(struct eth_dev *dev)
{
-#if !defined(DEV_CONFIG_SUBSET)
+#if !defined(CONFIG_USB_ETH_SUBSET)
return 1; /* only cdc possible */
-#elif !defined(DEV_CONFIG_CDC)
+#elif !defined(CONFIG_USB_ETH_CDC)
return 0; /* only subset possible */
#else
return dev->cdc; /* depends on what hardware we found */
@@ -420,7 +405,7 @@ rndis_config = {
* get those drivers from MCCI, or bundled with various products.
*/
-#ifdef DEV_CONFIG_CDC
+#ifdef CONFIG_USB_ETH_CDC
static struct usb_interface_descriptor
control_intf = {
.bLength = sizeof control_intf,
@@ -459,7 +444,7 @@ static const struct usb_cdc_header_desc header_desc = {
.bcdCDC = __constant_cpu_to_le16(0x0110),
};
-#if defined(DEV_CONFIG_CDC) || defined(CONFIG_USB_ETH_RNDIS)
+#if defined(CONFIG_USB_ETH_CDC) || defined(CONFIG_USB_ETH_RNDIS)
static const struct usb_cdc_union_desc union_desc = {
.bLength = sizeof union_desc,
@@ -493,7 +478,7 @@ static const struct usb_cdc_acm_descriptor acm_descriptor = {
#endif
-#ifndef DEV_CONFIG_CDC
+#ifndef CONFIG_USB_ETH_CDC
/*
* "SAFE" loosely follows CDC WMC MDLM, violating the spec in various
@@ -543,7 +528,7 @@ static const struct usb_cdc_ether_desc ether_desc = {
.bNumberPowerFilters = 0,
};
-#if defined(DEV_CONFIG_CDC) || defined(CONFIG_USB_ETH_RNDIS)
+#if defined(CONFIG_USB_ETH_CDC) || defined(CONFIG_USB_ETH_RNDIS)
/*
* include the status endpoint if we can, even where it's optional.
@@ -575,7 +560,7 @@ fs_status_desc = {
};
#endif
-#ifdef DEV_CONFIG_CDC
+#ifdef CONFIG_USB_ETH_CDC
/* the default data interface has no endpoints ... */
@@ -630,7 +615,7 @@ rndis_data_intf = {
#endif
-#ifdef DEV_CONFIG_SUBSET
+#ifdef CONFIG_USB_ETH_SUBSET
/*
* "Simple" CDC-subset option is a simple vendor-neutral model that most
@@ -676,7 +661,7 @@ fs_sink_desc = {
static const struct usb_descriptor_header *fs_eth_function[11] = {
(struct usb_descriptor_header *) &otg_descriptor,
-#ifdef DEV_CONFIG_CDC
+#ifdef CONFIG_USB_ETH_CDC
/* "cdc" mode descriptors */
(struct usb_descriptor_header *) &control_intf,
(struct usb_descriptor_header *) &header_desc,
@@ -690,12 +675,12 @@ static const struct usb_descriptor_header *fs_eth_function[11] = {
(struct usb_descriptor_header *) &fs_source_desc,
(struct usb_descriptor_header *) &fs_sink_desc,
NULL,
-#endif /* DEV_CONFIG_CDC */
+#endif /* CONFIG_USB_ETH_CDC */
};
static inline void fs_subset_descriptors(void)
{
-#ifdef DEV_CONFIG_SUBSET
+#ifdef CONFIG_USB_ETH_SUBSET
/* behavior is "CDC Subset"; extra descriptors say "SAFE" */
fs_eth_function[1] = (struct usb_descriptor_header *) &subset_data_intf;
fs_eth_function[2] = (struct usb_descriptor_header *) &header_desc;
@@ -733,7 +718,7 @@ static const struct usb_descriptor_header *fs_rndis_function[] = {
* descriptors, unless they only run at full speed.
*/
-#if defined(DEV_CONFIG_CDC) || defined(CONFIG_USB_ETH_RNDIS)
+#if defined(CONFIG_USB_ETH_CDC) || defined(CONFIG_USB_ETH_RNDIS)
static struct usb_endpoint_descriptor
hs_status_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
@@ -743,7 +728,7 @@ hs_status_desc = {
.wMaxPacketSize = __constant_cpu_to_le16(STATUS_BYTECOUNT),
.bInterval = LOG2_STATUS_INTERVAL_MSEC + 4,
};
-#endif /* DEV_CONFIG_CDC */
+#endif /* CONFIG_USB_ETH_CDC */
static struct usb_endpoint_descriptor
hs_source_desc = {
@@ -776,7 +761,7 @@ dev_qualifier = {
static const struct usb_descriptor_header *hs_eth_function[11] = {
(struct usb_descriptor_header *) &otg_descriptor,
-#ifdef DEV_CONFIG_CDC
+#ifdef CONFIG_USB_ETH_CDC
/* "cdc" mode descriptors */
(struct usb_descriptor_header *) &control_intf,
(struct usb_descriptor_header *) &header_desc,
@@ -790,12 +775,12 @@ static const struct usb_descriptor_header *hs_eth_function[11] = {
(struct usb_descriptor_header *) &hs_source_desc,
(struct usb_descriptor_header *) &hs_sink_desc,
NULL,
-#endif /* DEV_CONFIG_CDC */
+#endif /* CONFIG_USB_ETH_CDC */
};
static inline void hs_subset_descriptors(void)
{
-#ifdef DEV_CONFIG_SUBSET
+#ifdef CONFIG_USB_ETH_SUBSET
/* behavior is "CDC Subset"; extra descriptors say "SAFE" */
hs_eth_function[1] = (struct usb_descriptor_header *) &subset_data_intf;
hs_eth_function[2] = (struct usb_descriptor_header *) &header_desc;
@@ -857,11 +842,11 @@ static struct usb_string strings[] = {
{ STRING_SERIALNUMBER, serial_number, },
{ STRING_DATA, "Ethernet Data", },
{ STRING_ETHADDR, ethaddr, },
-#ifdef DEV_CONFIG_CDC
+#ifdef CONFIG_USB_ETH_CDC
{ STRING_CDC, "CDC Ethernet", },
{ STRING_CONTROL, "CDC Communications Control", },
#endif
-#ifdef DEV_CONFIG_SUBSET
+#ifdef CONFIG_USB_ETH_SUBSET
{ STRING_SUBSET, "CDC Ethernet Subset", },
#endif
#ifdef CONFIG_USB_ETH_RNDIS
@@ -878,7 +863,7 @@ static struct usb_gadget_strings stringtab = {
/*============================================================================*/
static u8 control_req[USB_BUFSIZ];
-#if defined(DEV_CONFIG_CDC) || defined(CONFIG_USB_ETH_RNDIS)
+#if defined(CONFIG_USB_ETH_CDC) || defined(CONFIG_USB_ETH_RNDIS)
static u8 status_req[STATUS_BYTECOUNT] __attribute__ ((aligned(4)));
#endif
@@ -967,7 +952,7 @@ set_ether_config(struct eth_dev *dev, gfp_t gfp_flags)
int result = 0;
struct usb_gadget *gadget = dev->gadget;
-#if defined(DEV_CONFIG_CDC) || defined(CONFIG_USB_ETH_RNDIS)
+#if defined(CONFIG_USB_ETH_CDC) || defined(CONFIG_USB_ETH_RNDIS)
/* status endpoint used for RNDIS and (optionally) CDC */
if (!subset_active(dev) && dev->status_ep) {
dev->status = ep_desc(gadget, &hs_status_desc,
@@ -1148,7 +1133,7 @@ static int eth_set_config(struct eth_dev *dev, unsigned number,
/*-------------------------------------------------------------------------*/
-#ifdef DEV_CONFIG_CDC
+#ifdef CONFIG_USB_ETH_CDC
/*
* The interrupt endpoint is used in CDC networking models (Ethernet, ATM)
@@ -1379,7 +1364,7 @@ eth_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
goto done_set_intf;
}
-#ifdef DEV_CONFIG_CDC
+#ifdef CONFIG_USB_ETH_CDC
switch (wIndex) {
case 0: /* control/master intf */
if (wValue != 0)
@@ -1421,7 +1406,7 @@ eth_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
* all non-PXA hardware talks real CDC ...
*/
debug("set_interface ignored!\n");
-#endif /* DEV_CONFIG_CDC */
+#endif /* CONFIG_USB_ETH_CDC */
done_set_intf:
break;
@@ -1444,7 +1429,7 @@ done_set_intf:
value = min(wLength, (u16) 1);
break;
-#ifdef DEV_CONFIG_CDC
+#ifdef CONFIG_USB_ETH_CDC
case USB_CDC_SET_ETHERNET_PACKET_FILTER:
/*
* see 6.2.30: no data, wIndex = interface,
@@ -1468,7 +1453,7 @@ done_set_intf:
* case USB_CDC_GET_ETHERNET_STATISTIC:
*/
-#endif /* DEV_CONFIG_CDC */
+#endif /* CONFIG_USB_ETH_CDC */
#ifdef CONFIG_USB_ETH_RNDIS
/*
@@ -2039,7 +2024,7 @@ static int eth_bind(struct usb_gadget *gadget)
u8 tmp[7];
/* these flags are only ever cleared; compiler take note */
-#ifndef DEV_CONFIG_CDC
+#ifndef CONFIG_USB_ETH_CDC
cdc = 0;
#endif
#ifndef CONFIG_USB_ETH_RNDIS
@@ -2151,7 +2136,7 @@ autoconf_fail:
goto autoconf_fail;
out_ep->driver_data = out_ep; /* claim */
-#if defined(DEV_CONFIG_CDC) || defined(CONFIG_USB_ETH_RNDIS)
+#if defined(CONFIG_USB_ETH_CDC) || defined(CONFIG_USB_ETH_RNDIS)
/*
* CDC Ethernet control interface doesn't require a status endpoint.
* Since some hosts expect one, try to allocate one anyway.
@@ -2163,7 +2148,7 @@ autoconf_fail:
} else if (rndis) {
error("can't run RNDIS on %s", gadget->name);
return -ENODEV;
-#ifdef DEV_CONFIG_CDC
+#ifdef CONFIG_USB_ETH_CDC
} else if (cdc) {
control_intf.bNumEndpoints = 0;
/* FIXME remove endpoint from descriptor list */
@@ -2206,7 +2191,7 @@ autoconf_fail:
fs_source_desc.bEndpointAddress;
hs_sink_desc.bEndpointAddress =
fs_sink_desc.bEndpointAddress;
-#if defined(DEV_CONFIG_CDC) || defined(CONFIG_USB_ETH_RNDIS)
+#if defined(CONFIG_USB_ETH_CDC) || defined(CONFIG_USB_ETH_RNDIS)
if (status_ep)
hs_status_desc.bEndpointAddress =
fs_status_desc.bEndpointAddress;
@@ -2275,7 +2260,7 @@ autoconf_fail:
dev->req->complete = eth_setup_complete;
/* ... and maybe likewise for status transfer */
-#if defined(DEV_CONFIG_CDC) || defined(CONFIG_USB_ETH_RNDIS)
+#if defined(CONFIG_USB_ETH_CDC) || defined(CONFIG_USB_ETH_RNDIS)
if (dev->status_ep) {
dev->stat_req = usb_ep_alloc_request(dev->status_ep,
GFP_KERNEL);
--
1.7.8.6
prev parent reply other threads:[~2012-09-23 14:35 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-23 14:35 [U-Boot] [PATCH v2 0/6] Add h2200 support and pxa25x ethernet gadget Lukasz Dalek
2012-09-23 14:35 ` [U-Boot] [PATCH v2 1/6] h2200: Add support for iPAQ h2200 palmtop Lukasz Dalek
2012-09-23 15:43 ` Marek Vasut
2012-09-23 19:11 ` Łukasz Dałek
2012-09-23 19:31 ` Marek Vasut
2012-09-23 19:39 ` Łukasz Dałek
2012-09-23 20:05 ` Marek Vasut
2012-09-23 20:24 ` Łukasz Dałek
2012-09-23 20:52 ` Marek Vasut
2012-09-23 21:00 ` Łukasz Dałek
2012-09-23 21:04 ` Marek Vasut
2012-09-23 21:11 ` Łukasz Dałek
2012-09-23 21:31 ` Marek Vasut
2012-09-23 21:43 ` Łukasz Dałek
2012-09-23 23:05 ` Marek Vasut
2012-09-23 23:16 ` Łukasz Dałek
2012-09-23 23:25 ` Marek Vasut
2012-09-23 23:39 ` Łukasz Dałek
2012-09-24 1:23 ` Marek Vasut
2012-09-23 14:35 ` [U-Boot] [PATCH v2 2/6] pxa25x: Add support for USB ethernet gadget Lukasz Dalek
2012-09-23 15:44 ` Marek Vasut
2012-09-23 18:16 ` Łukasz Dałek
2012-09-23 18:24 ` Marek Vasut
2012-09-23 18:50 ` Łukasz Dałek
2012-09-23 19:32 ` Marek Vasut
2012-09-23 19:44 ` Łukasz Dałek
2012-09-23 20:05 ` Marek Vasut
2012-09-23 14:35 ` [U-Boot] [PATCH v2 3/6] pxa: Add some stuff to examine cpu model and rev Lukasz Dalek
2012-09-23 14:35 ` [U-Boot] [PATCH v2 4/6] usbether: Fixed bug when using with PXA25X chips Lukasz Dalek
2012-09-23 14:35 ` [U-Boot] [PATCH v2 5/6] usbether: Define CONFIG_USB_ETH_{CDC, SUBSET} Lukasz Dalek
2012-09-23 14:35 ` Lukasz Dalek [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1348410936-335-7-git-send-email-luk0104@gmail.com \
--to=luk0104@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.