#include "gadget_chips.h"
#define USB_NET_NAME "usb0"
-#define dprintf(x, ...)
-#undef INFO
-#define INFO(x, s...) printf(s)
-#define dev_err(x, stuff...) printf(stuff)
-#define dev_dbg dev_err
-#define dev_warn dev_err
-#define DEBUG dev_err
-#define VDEBUG DEBUG
+
#define atomic_read
extern struct platform_data brd;
#define spin_lock(x)
result = usb_ep_enable (dev->status_ep, dev->status);
if (result != 0) {
- printf ("enable %s --> %d\n",
+ debug("enable %s --> %d\n",
dev->status_ep->name, result);
goto done;
}
if (!cdc_active(dev)) {
result = usb_ep_enable (dev->in_ep, dev->in);
if (result != 0) {
- printf ("enable %s --> %d\n",
+ debug("enable %s --> %d\n",
dev->in_ep->name, result);
goto done;
}
result = usb_ep_enable (dev->out_ep, dev->out);
if (result != 0) {
- printf ("enable %s --> %d\n",
+ debug("enable %s --> %d\n",
dev->out_ep->name, result);
goto done;
}
if (dev->config == 0)
return;
+ debug("%s\n", __func__);
+
/* disable endpoints, forcing (synchronous) completion of
* pending i/o. then free the requests.
*/
&& dev->config
&& dev->tx_qlen != 0) {
/* tx fifo is full, but we can't clear it...*/
- INFO (dev, "can't change configurations\n");
+ error("can't change configurations");
return -ESPIPE;
}
eth_reset_config (dev);
}
dev->config = number;
- INFO (dev, "%s speed config #%d: %d mA, %s, using %s\n",
+ printf("%s speed config #%d: %d mA, %s, using %s\n",
speed, number, power, driver_desc,
(cdc_active(dev)? "CDC Ethernet"
: "CDC Ethernet Subset"));
req->length = STATUS_BYTECOUNT;
value = usb_ep_queue (ep, req, GFP_ATOMIC);
- dprintf ("send SPEED_CHANGE --> %d\n", value);
+ debug("send SPEED_CHANGE --> %d\n", value);
if (value == 0)
return;
} else if (value != -ECONNRESET) {
- dprintf("event %02x --> %d\n",
+ debug("event %02x --> %d\n",
event->bNotificationType, value);
if (event->bNotificationType==
USB_CDC_NOTIFY_SPEED_CHANGE)
value = usb_ep_queue (dev->status_ep, req, GFP_ATOMIC);
if (value < 0)
- printf ("status buf queue --> %d\n", value);
+ debug("status buf queue --> %d\n", value);
}
#endif
static void eth_setup_complete (struct usb_ep *ep, struct usb_request *req)
{
if (req->status || req->actual != req->length)
- dprintf (/*(struct eth_dev *) ep->driver_data*/
- "setup complete --> %d, %d/%d\n",
+ debug("setup complete --> %d, %d/%d\n",
req->status, req->actual, req->length);
}
* while config change events may enable network traffic.
*/
- dprintf("eth_setup:...\n");
+ debug("%s\n", __func__);
req->complete = eth_setup_complete;
switch (ctrl->bRequest) {
if (ctrl->bRequestType != 0)
break;
if (gadget->a_hnp_support)
- DEBUG (dev, "HNP available\n");
+ debug("HNP available\n");
else if (gadget->a_alt_hnp_support)
- DEBUG (dev, "HNP needs a different root port\n");
+ debug("HNP needs a different root port\n");
value = eth_set_config (dev, wValue, GFP_ATOMIC);
break;
case USB_REQ_GET_CONFIGURATION:
/* FIXME this is wrong, as is the assumption that
* all non-PXA hardware talks real CDC ...
*/
- dev_warn (&gadget->dev, "set_interface ignored!\n");
+ debug("set_interface ignored!\n");
#endif /* DEV_CONFIG_CDC */
done_set_intf:
|| wLength != 0
|| wIndex > 1)
break;
- printf ("packet filter %02x\n", wValue);
+ debug("packet filter %02x\n", wValue);
dev->cdc_filter = wValue;
value = 0;
break;
#endif /* DEV_CONFIG_CDC */
default:
- printf (
- "unknown control req%02x.%02x v%04x i%04x l%d\n",
+ debug("unknown control req%02x.%02x v%04x i%04x l%d\n",
ctrl->bRequestType, ctrl->bRequest,
wValue, wIndex, wLength);
}
/* respond with data transfer before status phase? */
if (value >= 0) {
- dprintf("respond with data transfer before status phase\n");
+ debug("respond with data transfer before status phase\n");
req->length = value;
req->zero = value < wLength
&& (value % gadget->ep0->maxpacket) == 0;
value = usb_ep_queue (gadget->ep0, req, GFP_ATOMIC);
if (value < 0) {
- DEBUG (dev, "ep_queue --> %d\n", value);
+ debug("ep_queue --> %d\n", value);
req->status = 0;
eth_setup_complete (gadget->ep0, req);
}
* byte off the end (to force hardware errors on overflow).
*/
- dprintf("%s\n", __func__);
+ debug("%s\n", __func__);
size = (ETHER_HDR_SIZE + dev->mtu + RX_EXTRA);
size += dev->out_ep->maxpacket - 1;
retval = usb_ep_queue (dev->out_ep, req, gfp_flags);
if (retval) {
- dprintf ("rx submit --> %d\n", retval);
+ error("rx submit --> %d", retval);
}
return retval;
}
{
struct eth_dev *dev = ep->driver_data;
- dprintf("%s\n", __func__);
- dprintf("rx status %d\n", req->status);
+ debug("%s: status %d\n", __func__, req->status);
packet_received=1;
return 0;
fail:
- DEBUG (dev, "can't alloc requests\n");
+ error("can't alloc requests");
return -1;
}
static void tx_complete (struct usb_ep *ep, struct usb_request *req)
{
- dprintf("%s, status: %s\n", __func__,(req->status) ? "failed":"ok");
+ debug("%s: status %s\n", __func__, (req->status)?"failed":"ok");
packet_sent=1;
}
{
struct eth_dev *dev = get_gadget_data (gadget);
- printf("eth_unbind:...\n");
+ debug("%s...\n", __func__);
if (dev->stat_req) {
usb_ep_free_request (dev->status_ep, dev->stat_req);
* anything less functional on CDC-capable hardware,
* so we fail in this case.
*/
- dev_err (&gadget->dev,
- "controller '%s' not recognized\n",
+ error("controller '%s' not recognized",
gadget->name);
return -ENODEV;
}
in_ep = usb_ep_autoconfig (gadget, &fs_source_desc);
if (!in_ep) {
autoconf_fail:
- dev_err (&gadget->dev,
- "can't autoconfigure on %s\n",
+ error("can't autoconfigure on %s\n",
gadget->name);
return -ENODEV;
}
dev->host_mac [2], dev->host_mac [3],
dev->host_mac [4], dev->host_mac [5]);
- INFO (dev, "using %s, OUT %s IN %s%s%s\n", gadget->name,
+ printf("using %s, OUT %s IN %s%s%s\n", gadget->name,
out_ep->name, in_ep->name,
status_ep ? " STATUS " : "",
status_ep ? status_ep->name : ""
);
- INFO (dev, "MAC %02x:%02x:%02x:%02x:%02x:%02x\n",
+ printf("MAC %02x:%02x:%02x:%02x:%02x:%02x\n",
dev->net->enetaddr [0], dev->net->enetaddr [1],
dev->net->enetaddr [2], dev->net->enetaddr [3],
dev->net->enetaddr [4], dev->net->enetaddr [5]);
if (cdc) {
- INFO (dev, "HOST MAC %02x:%02x:%02x:%02x:%02x:%02x\n",
+ printf("HOST MAC %02x:%02x:%02x:%02x:%02x:%02x\n",
dev->host_mac [0], dev->host_mac [1],
dev->host_mac [2], dev->host_mac [3],
dev->host_mac [4], dev->host_mac [5]);
return 0;
fail:
- dev_dbg(&gadget->dev, "register_netdev failed\n");
+ error("%s failed", __func__);
eth_unbind (gadget);
return -ENOMEM;
}
unsigned long timeout = USB_CONNECT_TIMEOUT;
if (!netdev) {
- printf("ERROR: received NULL ptr\n");
+ error("received NULL ptr");
goto fail;
}
{
/* Handle control-c and timeouts */
if (ctrlc() || (get_timer(ts) > timeout)) {
- printf("The remote end did not respond in time.\n");
+ error("The remote end did not respond in time.");
goto fail;
}
usb_gadget_handle_interrupts();
{
int retval;
struct usb_request *req = NULL;
+ struct eth_dev *dev = &l_ethdev;
- struct eth_dev *dev = &l_ethdev;
- dprintf("%s:...\n",__func__);
+ debug("%s:...\n", __func__);
req = dev->tx_req;
retval = usb_ep_queue (dev->in_ep, req, GFP_ATOMIC);
if (!retval)
- dprintf("%s: packet queued\n",__func__);
+ debug("%s: packet queued\n", __func__);
while(!packet_sent)
{
packet_sent=0;
if (packet_received)
{
- dprintf("%s: packet received \n",__func__);
+ debug("%s: packet received \n", __func__);
if (dev->rx_req)
{
NetReceive(NetRxPackets[0],dev->rx_req->length);
if (dev->rx_req)
rx_submit (dev, dev->rx_req, 0);
}
- else printf("dev->rx_req invalid\n");
+ else error("dev->rx_req invalid");
}
return 0;
}
if (!netdev)
{
- printf("ERROR: received NULL ptr\n");
+ error("received NULL ptr");
return;
}
host_addr[sizeof(host_addr)-1] = '\0';
if (!is_eth_addr_valid(dev_addr)) {
- printf("ERROR: Need valid 'usbnet_devaddr' to be set\n");
+ error("Need valid 'usbnet_devaddr' to be set");
status = -1;
}
if (!is_eth_addr_valid(host_addr)) {
- printf("ERROR: Need valid 'usbnet_hostaddr' to be set\n");
+ error("Need valid 'usbnet_hostaddr' to be set");
status = -1;
}
if (status)
return 0;
fail:
- printf("%s failed\n", __func__ );
+ error("%s failed. error = %d", __func__, status);
return status;
}