Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755189AbdHYIg1 (ORCPT ); Fri, 25 Aug 2017 04:36:27 -0400 Received: from mail-oi0-f45.google.com ([209.85.218.45]:35146 "EHLO mail-oi0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755065AbdHYIcq (ORCPT ); Fri, 25 Aug 2017 04:32:46 -0400 MIME-Version: 1.0 In-Reply-To: References: <1503418256-5215-1-git-send-email-oleksandrs@mellanox.com> From: Linus Walleij Date: Fri, 25 Aug 2017 10:32:44 +0200 Message-ID: Subject: Re: [patch v6 0/3] JTAG driver introduction To: Rick Altherr Cc: Oleksandr Shamray , "devicetree@vger.kernel.org" , =?UTF-8?B?SmnFmcOtIFDDrXJrbw==?= , Arnd Bergmann , system-sw-low-level@mellanox.com, Greg KH , OpenBMC Maillist , "linux-kernel@vger.kernel.org" , openocd-devel-owner@lists.sourceforge.net, mec@shout.net, Rob Herring , "linux-serial@vger.kernel.org" , vadimp@maellanox.com, Tobias Klauser , "linux-api@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1774 Lines: 46 On Thu, Aug 24, 2017 at 11:37 PM, Rick Altherr wrote: > On Thu, Aug 24, 2017 at 2:07 PM, Linus Walleij wrote: >> On Tue, Aug 22, 2017 at 6:10 PM, Oleksandr Shamray >> wrote: >> >>> SoC which are not equipped with JTAG master interface, can be built >>> on top of JTAG core driver infrastructure, by applying bit-banging of >>> TDI, TDO, TCK and TMS pins within the hardware specific driver. >> >> I guess you mean it should then use GPIO lines for bit-banging? >> >> I was wondering about how some JTAG clients like openOCD does >> this in some cases. > > Many common uses of OpenOCD leverage USB devices, such as FTDI FT232R, > that have a command queue for bitbanging operations. Managing these > via libusb is ugly but platform-agnostic. Incidentally, people are sending patches to expose the FTDI expanders as common GPIO chips under Linux, so we can internally in the kernel or from the usersapce character device access them as "some GPIOs". >> In my worst nightmare they export GPIO lines using >> the horrid ABI in /sys/gpio/* > > https://sourceforge.net/p/openocd/code/ci/v0.10.0/tree/src/jtag/drivers/sysfsgpio.c Gnah! Whoever writes a slot-in replacement making the character device take precendence wins lots of karma. > While that is certainly horrible (and slow), mapping in the GPIO > registers via /dev/mem strikes me as worse: > > https://sourceforge.net/p/openocd/code/ci/v0.10.0/tree/src/jtag/drivers/bcm2835gpio.c Yeah that is quite horrible. There were reasons to do things like that, but since we have developed .set_multiple() to hammer several lines in a register at once, the same efficiency can be achieved using the standard character device. Yours, Linus Walleij