Re: PXA27x UDC Power

Justin Clacherty <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
Justin Clacherty wrote:
> Given that it won't likely change over the lifetime of the product is it 
> better to implement this as a compile time kernel configuration option 
> rather than a command line option?
>   
How's this?

diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index d80b1e4..68f150e 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -468,6 +468,17 @@ config USB_ETH_RNDIS
        XP, you'll need to download drivers from Microsoft's website; a URL
        is given in comments found in that info file.
 
+config USB_ETH_HIGH_POWER
+    bool "High power device support"
+    depends on USB_ETH
+    default n
+    help
+       Some devices need to use a higher powered port to make it easier
+       to recharge batteries.
+
+       If you say "y" here, the ethernet device configurations will be
+       changed to require a 500 mA port.
+
 config USB_GADGETFS
     tristate "Gadget Filesystem (EXPERIMENTAL)"
     depends on EXPERIMENTAL
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 7d4fb96..3583a20 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -443,8 +443,6 @@ static inline int BITRATE(struct usb_gadget *g)
  * NOTE:  Controllers like superh_udc should probably be able to use
  * an RNDIS-only configuration.
  *
- * FIXME define some higher-powered configurations to make it easier
- * to recharge batteries ...
  */
 
 #define DEV_CONFIG_VALUE    1    /* cdc or subset */
@@ -486,7 +484,12 @@ eth_config = {
     .bConfigurationValue =    DEV_CONFIG_VALUE,
     .iConfiguration =    STRING_CDC,
     .bmAttributes =        USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER,
+
+#ifdef  CONFIG_USB_ETH_HIGH_POWER
+    .bMaxPower =        250,
+#else
     .bMaxPower =        50,
+#endif
 };
 
 #ifdef    CONFIG_USB_ETH_RNDIS
@@ -500,7 +503,12 @@ rndis_config = {
     .bConfigurationValue =  DEV_RNDIS_CONFIG_VALUE,
     .iConfiguration =       STRING_RNDIS,
     .bmAttributes =        USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER,
-    .bMaxPower =            50,
+
+#ifdef  CONFIG_USB_ETH_HIGH_POWER
+    .bMaxPower =        250,
+#else
+    .bMaxPower =        50,
+#endif
 };
 #endif


-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.