From owner-freebsd-hackers@FreeBSD.ORG  Fri Feb  6 12:34:09 2015
Return-Path: <owner-freebsd-hackers@FreeBSD.ORG>
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 27D889E7
 for <freebsd-hackers@freebsd.org>; Fri,  6 Feb 2015 12:34:09 +0000 (UTC)
Received: from ipmail06.adl6.internode.on.net (ipmail06.adl6.internode.on.net
 [150.101.137.145])
 by mx1.freebsd.org (Postfix) with ESMTP id A2191B4F
 for <freebsd-hackers@freebsd.org>; Fri,  6 Feb 2015 12:34:07 +0000 (UTC)
Received: from ppp118-210-197-72.lns20.adl6.internode.on.net (HELO
 midget.dons.net.au) ([118.210.197.72])
 by ipmail06.adl6.internode.on.net with ESMTP; 06 Feb 2015 23:04:04 +1030
Received: from auxxoconnd1m1.dons.net.au (AUXXOCONND1M1.dons.net.au
 [10.0.2.104]) (authenticated bits=0)
 by midget.dons.net.au (8.15.1/8.14.9) with ESMTPSA id t16CXw8B000536
 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
 Fri, 6 Feb 2015 23:04:01 +1030 (CST)
 (envelope-from darius@dons.net.au)
Subject: Re: Two drivers sharing a single PCI device
Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\))
Content-Type: text/plain; charset=windows-1252
From: "O'Connor, Daniel" <darius@dons.net.au>
In-Reply-To: <54D4ABA6.805@selasky.org>
Date: Fri, 6 Feb 2015 23:03:58 +1030
Content-Transfer-Encoding: quoted-printable
Message-Id: <F6DF0E64-EFFC-4CC9-8375-85F88AE0941F@dons.net.au>
References: <643918BB-810C-4FB2-AE1A-C4CDA6C8A661@dons.net.au>
 <54D4ABA6.805@selasky.org>
To: Hans Petter Selasky <hps@selasky.org>
X-Mailer: Apple Mail (2.2070.6)
X-Spam-Score: -2.909 () ALL_TRUSTED,BAYES_00,T_RP_MATCHES_RCVD,URIBL_BLOCKED
X-Scanned-By: MIMEDefang 2.75 on 10.0.2.1
Cc: FreeBSD Hackers <freebsd-hackers@freebsd.org>
X-BeenThere: freebsd-hackers@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: Technical Discussions relating to FreeBSD
 <freebsd-hackers.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-hackers>, 
 <mailto:freebsd-hackers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-hackers/>
List-Post: <mailto:freebsd-hackers@freebsd.org>
List-Help: <mailto:freebsd-hackers-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-hackers>,
 <mailto:freebsd-hackers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2015 12:34:09 -0000


> On 6 Feb 2015, at 22:25, Hans Petter Selasky <hps@selasky.org> wrote:
> On 02/06/15 04:50, O'Connor, Daniel wrote:
>> Hi,
>> I am working on an EHCI debug driver and I have the basics working =
(attach, probe for a debug dongle and send data back and forth) - =
https://bitbucket.org/DJOConnor/dbgp
>>=20
>> However one problem remaining is that for it to work you have to =
detach the EHCI driver (obviously rather suboptimal :) so I am wondering =
what the best way would be to allow both ehci and dbgp to attach to the =
same PCI device.
>>=20
>> The dbgp driver doesn't touch the EHCI registers once it's running =
but it does have some code to start the EHCI controller and reset the =
port during attach.
>>=20
>> I can modify echi so it uses RF_SHAREABLE which should allow them to =
get newbus handles to the same area but the problem is that only one =
probe routine gets called.
>=20
> You possibly want "D_TRACKCLOSE" in d_flags in your cdevsw.

> What's the advantage of using the debug port over the regular EHCI USB =
interface?

I don't think that would help. It is supposed to be (largely) separate =
from the regular EHCI controller - it has it's own register set and it =
can steal the debug port from the regular controller so it doesn't =
appear occupied (although there is a bit of messing around on port =
reset).

The advantage is that it runs separately to the EHCI interface and it is =
quite simple to talk to, there is more information in appendix C of the =
USB 2 spec (usb_20.pdf).

--
Daniel O'Connor
"The nice thing about standards is that there
are so many of them to choose from."
 -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C