Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Implementation requirements of usb_needs_reattac...
details: https://anonhg.NetBSD.org/src/rev/4140ed21e1a1
branches: trunk
changeset: 573259:4140ed21e1a1
user: joff <joff%NetBSD.org@localhost>
date: Mon Jan 24 01:30:38 2005 +0000
description:
Implementation requirements of usb_needs_reattach(), from OpenBSD and required
for atu(4) to do a USB reconnect after firmware upload.
diffstat:
sys/dev/usb/uhub.c | 11 +++++++----
sys/dev/usb/usb.c | 13 +++++++++++--
sys/dev/usb/usbdivar.h | 4 +++-
3 files changed, 21 insertions(+), 7 deletions(-)
diffs (112 lines):
diff -r 8c7cc3b4c2f5 -r 4140ed21e1a1 sys/dev/usb/uhub.c
--- a/sys/dev/usb/uhub.c Mon Jan 24 01:21:31 2005 +0000
+++ b/sys/dev/usb/uhub.c Mon Jan 24 01:30:38 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uhub.c,v 1.71 2004/10/26 05:00:59 augustss Exp $ */
+/* $NetBSD: uhub.c,v 1.72 2005/01/24 01:30:38 joff Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */
/*
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.71 2004/10/26 05:00:59 augustss Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.72 2005/01/24 01:30:38 joff Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -310,6 +310,7 @@
else
up->power = USB_MIN_POWER;
up->restartcnt = 0;
+ up->reattach = 0;
if (UHUB_IS_HIGH_SPEED(sc)) {
up->tt = &tts[UHUB_IS_SINGLE_TT(sc) ? 0 : p];
up->tt->hub = hub;
@@ -356,7 +357,7 @@
usbd_status err;
int speed;
int port;
- int change, status;
+ int change, status, reconnect;
DPRINTFN(10, ("uhub_explore dev=%p addr=%d\n", dev, dev->address));
@@ -377,6 +378,8 @@
}
status = UGETW(up->status.wPortStatus);
change = UGETW(up->status.wPortChange);
+ reconnect = up->reattach;
+ up->reattach = 0;
DPRINTFN(3,("uhub_explore: %s port %d status 0x%04x 0x%04x\n",
USBDEVNAME(sc->sc_dev), port, status, change));
if (change & UPS_C_PORT_ENABLED) {
@@ -403,7 +406,7 @@
USBDEVNAME(sc->sc_dev), port);
}
}
- if (!(change & UPS_C_CONNECT_STATUS)) {
+ if (!reconnect && !(change & UPS_C_CONNECT_STATUS)) {
DPRINTFN(3,("uhub_explore: port=%d !C_CONNECT_"
"STATUS\n", port));
/* No status change, just do recursive explore. */
diff -r 8c7cc3b4c2f5 -r 4140ed21e1a1 sys/dev/usb/usb.c
--- a/sys/dev/usb/usb.c Mon Jan 24 01:21:31 2005 +0000
+++ b/sys/dev/usb/usb.c Mon Jan 24 01:30:38 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usb.c,v 1.80 2003/11/07 17:03:25 wiz Exp $ */
+/* $NetBSD: usb.c,v 1.81 2005/01/24 01:30:38 joff Exp $ */
/*
* Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.80 2003/11/07 17:03:25 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.81 2005/01/24 01:30:38 joff Exp $");
#include "ohci.h"
#include "uhci.h"
@@ -678,6 +678,15 @@
wakeup(&dev->bus->needs_explore);
}
+void
+usb_needs_reattach(usbd_device_handle dev)
+{
+ DPRINTFN(2,("usb_needs_reattach\n"));
+ dev->powersrc->reattach = 1;
+ dev->bus->needs_explore = 1;
+ wakeup(&dev->bus->needs_explore);
+}
+
/* Called at splusb() */
int
usb_get_next_event(struct usb_event *ue)
diff -r 8c7cc3b4c2f5 -r 4140ed21e1a1 sys/dev/usb/usbdivar.h
--- a/sys/dev/usb/usbdivar.h Mon Jan 24 01:21:31 2005 +0000
+++ b/sys/dev/usb/usbdivar.h Mon Jan 24 01:30:38 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdivar.h,v 1.72 2004/10/23 16:17:56 augustss Exp $ */
+/* $NetBSD: usbdivar.h,v 1.73 2005/01/24 01:30:38 joff Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $ */
/*
@@ -83,6 +83,7 @@
u_int8_t portno;
u_int8_t restartcnt;
#define USBD_RESTART_MAX 5
+ u_int8_t reattach;
struct usbd_device *device; /* Connected device */
struct usbd_device *parent; /* The ports hub */
struct usbd_tt *tt; /* Transaction translator (if any) */
@@ -260,6 +261,7 @@
/* Routines from usb.c */
void usb_needs_explore(usbd_device_handle);
+void usb_needs_reattach(usbd_device_handle);
void usb_schedsoftintr(struct usbd_bus *);
/*
Home |
Main Index |
Thread Index |
Old Index