From owner-freebsd-hackers@FreeBSD.ORG Sat Feb 7 06:06:17 2015 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 389A0107 for ; Sat, 7 Feb 2015 06:06:17 +0000 (UTC) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E89C0BBA for ; Sat, 7 Feb 2015 06:06:16 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id A004A1FE023; Sat, 7 Feb 2015 07:06:12 +0100 (CET) Message-ID: <54D5AB87.9050309@selasky.org> Date: Sat, 07 Feb 2015 07:07:03 +0100 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: "O'Connor, Daniel" Subject: Re: Two drivers sharing a single PCI device References: <643918BB-810C-4FB2-AE1A-C4CDA6C8A661@dons.net.au> <54D4ABA6.805@selasky.org> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: FreeBSD Hackers X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Feb 2015 06:06:17 -0000 On 02/06/15 13:33, O'Connor, Daniel wrote: > >> On 6 Feb 2015, at 22:25, Hans Petter Selasky 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 >>> >>> 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. >>> >>> 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. >>> >>> 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. >> >> 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). > Hi, You know about "sys/boot/usb" ? If you could integrate the USB debug port to use the kernel USB stack HOST API, only limited to BULK, CONTROL and INTERRUPT, then we could easily use it there aswell. The EHCI debug port functions very much resemble those found in "sys/dev/usb/controller/dwc_otg*" for example. --HPS