Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3292545imm; Tue, 29 May 2018 04:50:59 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpDdZfJIVWJsBWU2eJfny6GlsFIzoB1QBtB9nlHJlXADxn8hDHkCemlpXy17/iDyOKWeiZ9 X-Received: by 2002:a63:b107:: with SMTP id r7-v6mr13506142pgf.167.1527594659717; Tue, 29 May 2018 04:50:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527594659; cv=none; d=google.com; s=arc-20160816; b=P4wTU0HjTlajqNCfeZ7Lw3wyLjijkc8q9CZh2YcUYbj5hv/OTHkSu99mgp9yB5sF4W iC5Lp5k2P8Y0qrav2mdiFjKXVmAtHAtZg3H7sbOncy1Sn/V4rar9ym8C2AHK5sPj7ytN pQl7ArXSfSPZU6i4gUZHuJ0e/dPhDujIYjREak13xt3sEyQBbjMksi2LVlZN7IIjl/5B k52lbmM8y4rrmUzb+pwyvKdC8aLlWPp09k7RTWMxhiDHjZOzGIDWIB3pfdrrEMXnxM4g K7vAxR7i63AWGxCgNWZkB8yLRR66EMMxBDt+VvwHAYoq3R3OfRLhA5t8uXIb0rHsFR7U ZIgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=W8ZMpWc3yc/5UB93J4RrNi6rQmc6lb/R8aSZ1Cu/rL0=; b=gDbcwcHDTY6sb5g4VDCtjeaSFQCyRpk9qbH8/L4bCWf+BF8FSxUkEzvFkVGfKo3/4H CT2McJzUYDQCkt3syxK/KqxiriXhm3ULPnuqtRFBR1Q14NyiUZj0ToUDPikevH8+9wIo kZwjppGH3AdCeJUEMc6/E1AT8tPa1yv40T4xl7y6SzOb+FrRnlOB/GSnumQ43dNASYq9 GPs8voR75lxN7Trx8hF90kID/rGxoDddBrn7pwPJIN5wlTzw/NRaUF6dPnjle70Gbejh eiLzUQlLwM10zG9v1LBjZ5gY4d96G9tyHhcbGxWdRZBSmsES/Ok6g7N1ldnHz5fCPQk1 HvTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p14-v6si25928689pgc.216.2018.05.29.04.50.45; Tue, 29 May 2018 04:50:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933430AbeE2LtM (ORCPT + 99 others); Tue, 29 May 2018 07:49:12 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:50039 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933387AbeE2LtH (ORCPT ); Tue, 29 May 2018 07:49:07 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from oleksandrs@mellanox.com) with ESMTPS (AES256-SHA encrypted); 29 May 2018 14:51:10 +0300 Received: from r-vnc16.mtr.labs.mlnx (r-vnc16.mtr.labs.mlnx [10.208.0.16]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w4TBn5wC002578; Tue, 29 May 2018 14:49:05 +0300 From: Oleksandr Shamray To: gregkh@linuxfoundation.org, arnd@arndb.de Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, openbmc@lists.ozlabs.org, joel@jms.id.au, jiri@resnulli.us, tklauser@distanz.ch, linux-serial@vger.kernel.org, vadimp@mellanox.com, system-sw-low-level@mellanox.com, robh+dt@kernel.org, openocd-devel-owner@lists.sourceforge.net, linux-api@vger.kernel.org, davem@davemloft.net, mchehab@kernel.org, Oleksandr Shamray Subject: [patch v23 0/4] JTAG driver introduction Date: Tue, 29 May 2018 14:49:01 +0300 Message-Id: <1527594545-19870-1-git-send-email-oleksandrs@mellanox.com> X-Mailer: git-send-email 1.7.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org JTAG driver introduction When a need raise up to use JTAG interface for system's devices programming or CPU debugging, usually the user layer application implements jtag protocol by bit-bang or using a proprietary connection to vendor hardware. This method can be slow and not generic. We propose to implement general JTAG interface and infrastructure to communicate with user layer application. In such way, we can have the standard JTAG interface core part and separation from specific HW implementation. This allow new capability to debug the CPU or program system's device via BMC without additional devices nor cost. This patch purpose is to add JTAG master core infrastructure by defining new JTAG class and provide generic JTAG interface to allow hardware specific drivers to connect this interface. This will enable all JTAG drivers to use the common interface part and will have separate for hardware implementation. The JTAG (Joint Test Action Group) core driver provides minimal generic JTAG interface, which can be used by hardware specific JTAG master controllers. By providing common interface for the JTAG controllers, user space device programing is hardware independent. Modern SoC which in use for embedded system' equipped with internal JTAG master interface. This interface is used for programming and debugging system's hardware components, like CPLD, FPGA, CPU, voltage and industrial controllers. Firmware for such devices can be upgraded through JTAG interface during Runtime. The JTAG standard support for multiple devices programming, is in case their lines are daisy-chained together. For example, systems which equipped with host CPU, BMC SoC or/and number of programmable devices are capable to connect a pin and select system components dynamically for programming and debugging, This is using by the BMC which is equipped with internal SoC master controller. For example: BMC JTAG master --> pin selected to CPLDs chain for programming (filed upgrade, production) BMC JTAG master --> pin selected to voltage monitors for programming (field upgrade, production) BMC JTAG master --> pin selected to host CPU (on-site debugging and developers debugging) For example, we can have application in user space which using calls to JTAG driver executes CPLD programming directly from SVF file The JTAG standard (IEEE 1149.1) defines the next connector pins: - TDI (Test Data In); - TDO (Test Data Out); - TCK (Test Clock); - TMS (Test Mode Select); - TRST (Test Reset) (Optional); The SoC equipped with JTAG master controller, performs device programming on command or vector level. For example a file in a standard SVF (Serial Vector Format) that contains boundary scan vectors, can be used by sending each vector to the JTAG interface and the JTAG controller will execute the programming. Initial version provides the system calls set for: - SIR (Scan Instruction Register, IEEE 1149.1 Instruction Register scan); - SDR (Scan Data Register, IEEE 1149.1 Data Register scan); - RUNTEST (Forces the IEEE 1149.1 bus to a run state for a specified number of clocks. 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. Oleksandr Shamray (4): drivers: jtag: Add JTAG core driver drivers: jtag: Add Aspeed SoC 24xx and 25xx families JTAG master driver Documentation: jtag: Add bindings for Aspeed SoC 24xx and 25xx families JTAG master driver Documentation: jtag: Add ABI documentation Documentation/ABI/testing/jtag-dev | 27 + .../devicetree/bindings/jtag/aspeed-jtag.txt | 22 + Documentation/ioctl/ioctl-number.txt | 2 + Documentation/jtag/overview | 27 + Documentation/jtag/transactions | 109 +++ MAINTAINERS | 10 + drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/jtag/Kconfig | 31 + drivers/jtag/Makefile | 2 + drivers/jtag/jtag-aspeed.c | 769 ++++++++++++++++++++ drivers/jtag/jtag.c | 279 +++++++ include/linux/jtag.h | 40 + include/uapi/linux/jtag.h | 109 +++ 14 files changed, 1430 insertions(+), 0 deletions(-) create mode 100644 Documentation/ABI/testing/jtag-dev create mode 100644 Documentation/devicetree/bindings/jtag/aspeed-jtag.txt create mode 100644 Documentation/jtag/overview create mode 100644 Documentation/jtag/transactions create mode 100644 drivers/jtag/Kconfig create mode 100644 drivers/jtag/Makefile create mode 100644 drivers/jtag/jtag-aspeed.c create mode 100644 drivers/jtag/jtag.c create mode 100644 include/linux/jtag.h create mode 100644 include/uapi/linux/jtag.h