Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/dwc2 Reduce diff to upstream by using



details:   https://anonhg.NetBSD.org/src/rev/74117f225c21
branches:  trunk
changeset: 343756:74117f225c21
user:      skrll <skrll%NetBSD.org@localhost>
date:      Wed Feb 24 22:17:54 2016 +0000

description:
Reduce diff to upstream by using

        sys/external/bsd/{include/workqueue.h,linux/linux_work.c}

This also fixes CI20 dwctwo start up as reported by macallan@

diffstat:

 sys/external/bsd/dwc2/conf/files.dwc2      |   7 ++-
 sys/external/bsd/dwc2/dist/dwc2_core.c     |   5 +-
 sys/external/bsd/dwc2/dist/dwc2_core.h     |   7 +--
 sys/external/bsd/dwc2/dist/dwc2_coreintr.c |   6 +-
 sys/external/bsd/dwc2/dist/dwc2_hcd.c      |  31 ++++++++---------
 sys/external/bsd/dwc2/dist/dwc2_hcd.h      |   6 +--
 sys/external/bsd/dwc2/dwc2.c               |  52 +----------------------------
 sys/external/bsd/dwc2/dwc2.h               |  25 +-------------
 8 files changed, 31 insertions(+), 108 deletions(-)

diffs (truncated from 353 to 300 lines):

diff -r b9fbb27100c7 -r 74117f225c21 sys/external/bsd/dwc2/conf/files.dwc2
--- a/sys/external/bsd/dwc2/conf/files.dwc2     Wed Feb 24 22:14:39 2016 +0000
+++ b/sys/external/bsd/dwc2/conf/files.dwc2     Wed Feb 24 22:17:54 2016 +0000
@@ -1,11 +1,12 @@
-#      $NetBSD: files.dwc2,v 1.2 2014/09/12 16:40:38 skrll Exp $
+#      $NetBSD: files.dwc2,v 1.3 2016/02/24 22:17:54 skrll Exp $
 
 # DesignWare HS OTG Controller
 #
-device dwctwo: usbus, usbroothub, usb_dma
+
+device dwctwo: usbus, usbroothub, usb_dma, linux
 file   external/bsd/dwc2/dwc2.c                        dwctwo  needs-flag
 
-makeoptions    dwctwo  CPPFLAGS+=" -I$S/external/bsd/common/include -I$S/external/bsd -I$S/external/bsd/dwc2/dist"
+makeoptions    dwctwo  CPPFLAGS+="-I$S/external/bsd -I$S/external/bsd/dwc2/dist"
 
 file   external/bsd/dwc2/dist/dwc2_core.c              dwctwo
 file   external/bsd/dwc2/dist/dwc2_coreintr.c          dwctwo
diff -r b9fbb27100c7 -r 74117f225c21 sys/external/bsd/dwc2/dist/dwc2_core.c
--- a/sys/external/bsd/dwc2/dist/dwc2_core.c    Wed Feb 24 22:14:39 2016 +0000
+++ b/sys/external/bsd/dwc2/dist/dwc2_core.c    Wed Feb 24 22:17:54 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dwc2_core.c,v 1.12 2016/02/24 22:14:39 skrll Exp $     */
+/*     $NetBSD: dwc2_core.c,v 1.13 2016/02/24 22:17:54 skrll Exp $     */
 
 /*
  * core.c - DesignWare HS OTG Controller common routines
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc2_core.c,v 1.12 2016/02/24 22:14:39 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2_core.c,v 1.13 2016/02/24 22:17:54 skrll Exp $");
 
 #include <sys/types.h>
 #include <sys/bus.h>
@@ -51,7 +51,6 @@
 #include <sys/callout.h>
 #include <sys/mutex.h>
 #include <sys/pool.h>
-#include <sys/workqueue.h>
 
 #include <dev/usb/usb.h>
 #include <dev/usb/usbdi.h>
diff -r b9fbb27100c7 -r 74117f225c21 sys/external/bsd/dwc2/dist/dwc2_core.h
--- a/sys/external/bsd/dwc2/dist/dwc2_core.h    Wed Feb 24 22:14:39 2016 +0000
+++ b/sys/external/bsd/dwc2/dist/dwc2_core.h    Wed Feb 24 22:17:54 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dwc2_core.h,v 1.7 2016/02/14 10:53:30 skrll Exp $      */
+/*     $NetBSD: dwc2_core.h,v 1.8 2016/02/24 22:17:54 skrll Exp $      */
 
 /*
  * core.h - DesignWare HS OTG Controller common declarations
@@ -40,7 +40,6 @@
 #define __DWC2_CORE_H__
 
 #include <sys/stdint.h>
-#include <sys/workqueue.h>
 #include <sys/pool.h>
 #include <sys/queue.h>
 #include <sys/device.h>
@@ -723,8 +722,8 @@
        unsigned int queuing_high_bandwidth:1;
        unsigned int srp_success:1;
 
-       struct workqueue *wq_otg;
-       struct work wf_otg;
+       struct workqueue_struct *wq_otg;
+       struct work_struct wf_otg;
        struct callout wkp_timer;
        enum dwc2_lx_state lx_state;
        struct dwc2_gregs_backup gr_backup;
diff -r b9fbb27100c7 -r 74117f225c21 sys/external/bsd/dwc2/dist/dwc2_coreintr.c
--- a/sys/external/bsd/dwc2/dist/dwc2_coreintr.c        Wed Feb 24 22:14:39 2016 +0000
+++ b/sys/external/bsd/dwc2/dist/dwc2_coreintr.c        Wed Feb 24 22:17:54 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dwc2_coreintr.c,v 1.10 2016/02/14 10:53:30 skrll Exp $ */
+/*     $NetBSD: dwc2_coreintr.c,v 1.11 2016/02/24 22:17:54 skrll Exp $ */
 
 /*
  * core_intr.c - DesignWare HS OTG Controller common interrupt handling
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc2_coreintr.c,v 1.10 2016/02/14 10:53:30 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2_coreintr.c,v 1.11 2016/02/24 22:17:54 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -307,7 +307,7 @@
         */
        if (hsotg->wq_otg) {
                spin_unlock(&hsotg->lock);
-               workqueue_enqueue(hsotg->wq_otg, &hsotg->wf_otg, NULL);
+               queue_work(hsotg->wq_otg, &hsotg->wf_otg);
                spin_lock(&hsotg->lock);
        }
 }
diff -r b9fbb27100c7 -r 74117f225c21 sys/external/bsd/dwc2/dist/dwc2_hcd.c
--- a/sys/external/bsd/dwc2/dist/dwc2_hcd.c     Wed Feb 24 22:14:39 2016 +0000
+++ b/sys/external/bsd/dwc2/dist/dwc2_hcd.c     Wed Feb 24 22:17:54 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dwc2_hcd.c,v 1.18 2016/02/14 10:53:30 skrll Exp $      */
+/*     $NetBSD: dwc2_hcd.c,v 1.19 2016/02/24 22:17:54 skrll Exp $      */
 
 /*
  * hcd.c - DesignWare HS OTG Controller host-mode routines
@@ -42,13 +42,12 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc2_hcd.c,v 1.18 2016/02/14 10:53:30 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2_hcd.c,v 1.19 2016/02/24 22:17:54 skrll Exp $");
 
 #include <sys/types.h>
 #include <sys/kmem.h>
 #include <sys/proc.h>
 #include <sys/pool.h>
-#include <sys/workqueue.h>
 
 #include <dev/usb/usb.h>
 #include <dev/usb/usbdi.h>
@@ -58,6 +57,7 @@
 #include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/err.h>
+#include <linux/workqueue.h>
 
 #include <dwc2/dwc2.h>
 #include <dwc2/dwc2var.h>
@@ -1365,8 +1365,7 @@
        }
 }
 
-void
-dwc2_conn_id_status_change(struct work *work)
+static void dwc2_conn_id_status_change(struct work_struct *work)
 {
        struct dwc2_hsotg *hsotg = container_of(work, struct dwc2_hsotg,
                                                wf_otg);
@@ -1427,7 +1426,7 @@
        }
 }
 
-void dwc2_wakeup_detected(void * data)
+void dwc2_wakeup_detected(void *data)
 {
        struct dwc2_hsotg *hsotg = (struct dwc2_hsotg *)data;
        u32 hprt0;
@@ -2157,8 +2156,7 @@
 /*
  * Work queue function for starting the HCD when A-Cable is connected
  */
-void
-dwc2_hcd_start_func(struct work *work)
+static void dwc2_hcd_start_func(struct work_struct *work)
 {
        struct dwc2_hsotg *hsotg = container_of(work, struct dwc2_hsotg,
                                                start_work.work);
@@ -2170,8 +2168,7 @@
 /*
  * Reset work queue function
  */
-void
-dwc2_hcd_reset_func(struct work *work)
+static void dwc2_hcd_reset_func(struct work_struct *work)
 {
        struct dwc2_hsotg *hsotg = container_of(work, struct dwc2_hsotg,
                                                reset_work.work);
@@ -2261,7 +2258,9 @@
        }
 
        if (hsotg->wq_otg) {
-               workqueue_destroy(hsotg->wq_otg);
+               if (!cancel_work_sync(&hsotg->wf_otg))
+                       flush_workqueue(hsotg->wq_otg);
+               destroy_workqueue(hsotg->wq_otg);
        }
 
        kmem_free(hsotg->core_params, sizeof(*hsotg->core_params));
@@ -2287,7 +2286,7 @@
 {
        struct dwc2_host_chan *channel;
        int i, num_channels;
-       int err, retval;
+       int retval;
 
        if (usb_disabled())
                return -ENODEV;
@@ -2326,14 +2325,12 @@
 
        /* Create new workqueue and init work */
        retval = -ENOMEM;
-       err = workqueue_create(&hsotg->wq_otg, "dwc2", dwc2_worker, hsotg,
-                        PRI_BIO, IPL_USB, WQ_MPSAFE);
-
-       retval = -err;
-       if (err) {
+       hsotg->wq_otg = create_singlethread_workqueue("dwc2");
+       if (!hsotg->wq_otg) {
                dev_err(hsotg->dev, "Failed to create workqueue\n");
                goto error2;
        }
+       INIT_WORK(&hsotg->wf_otg, dwc2_conn_id_status_change);
 
        callout_init(&hsotg->wkp_timer, CALLOUT_MPSAFE);
        callout_setfunc(&hsotg->wkp_timer, dwc2_wakeup_detected, hsotg);
diff -r b9fbb27100c7 -r 74117f225c21 sys/external/bsd/dwc2/dist/dwc2_hcd.h
--- a/sys/external/bsd/dwc2/dist/dwc2_hcd.h     Wed Feb 24 22:14:39 2016 +0000
+++ b/sys/external/bsd/dwc2/dist/dwc2_hcd.h     Wed Feb 24 22:17:54 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dwc2_hcd.h,v 1.12 2016/02/14 10:53:30 skrll Exp $      */
+/*     $NetBSD: dwc2_hcd.h,v 1.13 2016/02/24 22:17:54 skrll Exp $      */
 
 /*
  * hcd.h - DesignWare HS OTG Controller host-mode declarations
@@ -777,10 +777,6 @@
 void dwc2_hcd_urb_set_pipeinfo(struct dwc2_hsotg *, struct dwc2_hcd_urb *,
                               u8 ,u8, u8, u8, u16);
 
-void dwc2_conn_id_status_change(struct work *);
-void dwc2_hcd_start_func(struct work *);
-void dwc2_hcd_reset_func(struct work *);
-
 struct dwc2_hcd_urb * dwc2_hcd_urb_alloc(struct dwc2_hsotg *, int, gfp_t);
 void dwc2_hcd_urb_free(struct dwc2_hsotg *, struct dwc2_hcd_urb *, int);
 
diff -r b9fbb27100c7 -r 74117f225c21 sys/external/bsd/dwc2/dwc2.c
--- a/sys/external/bsd/dwc2/dwc2.c      Wed Feb 24 22:14:39 2016 +0000
+++ b/sys/external/bsd/dwc2/dwc2.c      Wed Feb 24 22:17:54 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dwc2.c,v 1.40 2016/02/24 22:09:09 skrll Exp $  */
+/*     $NetBSD: dwc2.c,v 1.41 2016/02/24 22:17:54 skrll Exp $  */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.40 2016/02/24 22:09:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.41 2016/02/24 22:17:54 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -1453,45 +1453,6 @@
 
 }
 
-#if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
-void
-dwc2_worker(struct work *wk, void *priv)
-{
-       struct dwc2_softc *sc = priv;
-       struct dwc2_hsotg *hsotg = sc->sc_hsotg;
-
-Debugger();
-#if 0
-       usbd_xfer_handle xfer = dwork->xfer;
-       struct dwc2_xfer *dxfer = DWC2_XFER2DXFER(xfer);
-
-       dwc2_hcd_endpoint_disable(sc->dwc_dev.hcd, dpipe->priv, 250);
-       dwc_free(NULL, dpipe->urb);
-#endif
-
-       mutex_enter(&sc->sc_lock);
-       if (wk == &hsotg->wf_otg) {
-               dwc2_conn_id_status_change(wk);
-       } else if (wk == &hsotg->start_work.work) {
-               dwc2_hcd_start_func(wk);
-       } else if (wk == &hsotg->reset_work.work) {
-               dwc2_hcd_reset_func(wk);
-       } else {
-#if 0
-               KASSERT(dwork->xfer != NULL);
-               KASSERT(dxfer->queued == true);
-
-               if (!(xfer->hcflags & UXFER_ABORTING)) {
-                       dwc2_start_standard_chain(xfer);
-               }
-               dxfer->queued = false;
-               cv_broadcast(&xfer->hccv);
-#endif
-       }
-       mutex_exit(&sc->sc_lock);
-}
-#endif
-
 int dwc2_intr(void *p)
 {
        struct dwc2_softc *sc = p;
@@ -1723,15 +1684,6 @@
 
 #endif
 
-
-void
-dw_callout(void *arg)



Home | Main Index | Thread Index | Old Index