From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] usbether: Fixed bug when using with PXA25X chips
Date: Fri, 17 Aug 2012 22:48:16 +0200 [thread overview]
Message-ID: <201208172248.16297.marex@denx.de> (raw)
In-Reply-To: <1345235499-32556-1-git-send-email-luk0104@gmail.com>
Dear ?ukasz Da?ek,
> PXA25X chips don't support alternate settings so code in ether.c
> disables usage of CDC.
> But only code defined between DEV_CONFIG_CDC signals that network is up.
> This patch is fixing this bug by addding pxa_connect_gadget() which on
> pxa25x chips signals that network is up and do nothing on any other
> chips.
You're getting better, it's a good sign you're learning, I'm glad to see it :-)
> Signed-off-by: ?ukasz Da?ek <luk0104@gmail.com>
> ---
> drivers/usb/gadget/ether.c | 21 ++++++++++++++++++++-
> 1 files changed, 20 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
> index d975fb6..964fe2e 100644
> --- a/drivers/usb/gadget/ether.c
> +++ b/drivers/usb/gadget/ether.c
> @@ -44,7 +44,12 @@ extern struct platform_data brd;
>
> unsigned packet_received, packet_sent;
>
> -#define DEV_CONFIG_CDC 1
> +#ifdef CONFIG_USB_GADGET_PXA2XX
> +# undef DEV_CONFIG_CDC
> +# define DEV_CONFIG_SUBSET 1
Can't we make it into a config value?
Does this work for you:
1) Add:
CONFIG_USB_ETH_SUBSET
CONFIG_USB_ETH_CDC
2) Change this to
#if !defined(...SUBSET) || !defined(...CDC) || !defined(RNDIS)
#define DEV_CONFIG_CDC /* preserve default behavior */
#endif
#if defined(...SUBSET)
#define DEV_CONFIG_SUBSET
#endif
#if defined(...CDC)
#define DEV_CONFIG_CDC
#endif
/* Note that RNDIS is already fixed */
-- FROM HERE IT GOES INTO DIFFERENT PATCH --
3) Replace DEV_CONFIG_CDC with CONFIG_USB_ETH_CDC, remove the last #if defined
above
4) DTTO for SUBSET
5) define SUBSET in your header file
is it clear?
> +#else
> +# define DEV_CONFIG_CDC 1
> +#endif
> #define GFP_ATOMIC ((gfp_t) 0)
> #define GFP_KERNEL ((gfp_t) 0)
>
> @@ -864,7 +869,9 @@ static struct usb_gadget_strings stringtab = {
>
> /*========================================================================
> ====*/ static u8 control_req[USB_BUFSIZ];
> +#if defined(DEV_CONFIG_CDC) || defined(CONFIG_USB_ETH_RNDIS)
> static u8 status_req[STATUS_BYTECOUNT] __attribute__ ((aligned(4)));
> +#endif
What trouble do you face here?
Tom, this aligned(4) doesn't look correct, some ALLOC_ALIGNED or friend would
help here, right ? :)
>
> /**
> @@ -1252,6 +1259,17 @@ static void rndis_command_complete(struct usb_ep
> *ep, struct usb_request *req)
>
> #endif /* RNDIS */
>
> +#ifdef CONFIG_USB_GADGET_PXA2XX
> +static inline void pxa_connect_gadget(void)
> +{
> + debug("PXA connecting gadget...\n");
> + l_ethdev.network_started = 1;
> + printf("USB network up!\n");
Definitelly not printf(), but is this really PXA specific or is this part of the
CDC subset goo?
> +}
> +#else
> +static inline void pxa_connect_gadget(void) { }
> +#endif
> +
> /*
> * The setup() callback implements all the ep0 functionality that's not
> * handled lower down. CDC has a number of less-common features:
> @@ -1352,6 +1370,7 @@ eth_setup(struct usb_gadget *gadget, const struct
> usb_ctrlrequest *ctrl) if (gadget_is_pxa(gadget)) {
> value = eth_set_config(dev, DEV_CONFIG_VALUE,
> GFP_ATOMIC);
> + pxa_connect_gadget();
> goto done_set_intf;
> }
Best regards,
Marek Vasut
next prev parent reply other threads:[~2012-08-17 20:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-17 20:31 [U-Boot] [PATCH 1/3] usbether: Fixed bug when using with PXA25X chips Łukasz Dałek
2012-08-17 20:31 ` [U-Boot] [PATCH 2/3] pxa25x: Add UDC registers definitions Łukasz Dałek
2012-08-17 20:50 ` Marek Vasut
2012-08-17 21:44 ` Łukasz Dałek
2012-08-17 23:24 ` Marek Vasut
2012-08-17 20:31 ` [U-Boot] [PATCH 3/3] pxa25x: Add USB ethernet gadget driver Łukasz Dałek
2012-08-17 20:57 ` Marek Vasut
2012-08-17 21:39 ` Łukasz Dałek
2012-08-17 23:25 ` Marek Vasut
2012-08-17 20:48 ` Marek Vasut [this message]
2012-08-17 22:07 ` [U-Boot] [PATCH 1/3] usbether: Fixed bug when using with PXA25X chips Łukasz Dałek
2012-08-17 23:32 ` Marek Vasut
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=201208172248.16297.marex@denx.de \
--to=marex@denx.de \
--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.