Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1298026imm; Wed, 15 Aug 2018 15:11:10 -0700 (PDT) X-Google-Smtp-Source: AA+uWPylepp5rLTWLL2IN29x3lANpCV47frWGp4d4ZCH35oBm2s2D/RP/IYtgLbdlXARF0NJVO7x X-Received: by 2002:a62:9ed1:: with SMTP id f78-v6mr29570493pfk.35.1534371070756; Wed, 15 Aug 2018 15:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534371070; cv=none; d=google.com; s=arc-20160816; b=c+bV4TvBs7R3d8+ViuCdIHuhLVxvlUJKKyCOGE4sS0c4P4D5m0GLLaCMSeVEY1u4x6 3XzBfmP0At5A1CfCZ30pQHdi4xJ4YT7dEiPWIkyH6oXw7ZzDJw0NgLIWfRmd+sAQlvTC 2hNp7zDMEejVdCI63Ff+sRBamYlYjCZ4xRrNuIuOGqheTgi6NFLh1WAc3AVMMs9wyRpJ jObOO2XGN8W67cW7oDRJ2k26hkqsS2DofZM3X+pAYVmdCBSLMQpuem232aedvZ69lKHW yavR2iob2KcnnZOOgtiTYzD0NSMl2z8yY6q6JdPdW0SYxEvmmZ5LEzzThiAdQVty6js1 069g== 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 :dkim-signature:arc-authentication-results; bh=bQy8VOmmfbNCDjEWwFbFBU3z8DIz+3tKWM2OJO3oRFE=; b=ivOTryqoXc/CXfMj9biCoJ9mvsRv9nRYDTubUkqLFaQesLU+V+0EfU9f5rVrl0VkAc 9L6WhugAc3lp3rWT2cdccOsH9HCmBfe5mJbtXM36L7Vm4bwdo8yLFtU0A56RW53wAXRn LUvnORJG5lJijY1SI7mQ5Dp5dIffZh/o7h6jLH+hix/wJ3zSdJdpW4/Ziye2O50o6SiT TWUO6IHLmolISzsARIua2baQ/kIRZ6t6ZJmfS9FGsc6H22Z/4G0oykKpCU9Il4dYSzV9 QjKTXHCTKen6BB8FckNpUzKWDKNKjxiZuspCdD9UM9ae+ws/dZ+sRW/GwwfX8+tCrj0l 62uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Fn8xdt1e; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f23-v6si21350169plj.494.2018.08.15.15.10.55; Wed, 15 Aug 2018 15:11:10 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Fn8xdt1e; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727987AbeHPBEG (ORCPT + 99 others); Wed, 15 Aug 2018 21:04:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:45084 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727126AbeHPBEG (ORCPT ); Wed, 15 Aug 2018 21:04:06 -0400 Received: from localhost.localdomain (user-0ccsrjt.cable.mindspring.com [24.206.110.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 14C6F21528; Wed, 15 Aug 2018 22:10:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1534371003; bh=AOdrRv4SDDzCjjCwU/NAUQu75U9uVNCFoHfEXlKErX4=; h=From:To:Cc:Subject:Date:From; b=Fn8xdt1eEMn916aSoBPzb+xrPM7MVlRLY3OldxBnk4gkz7/God4p/tRz9t4okJ47h ap/OCzEgMZLxgsRKwSTFLRaoP29/NnKOdD9CaEejRBjbvPFBf9b//R23vtfCnQVGuL bbGkNyNq591Jha+70dfHwi6PVTEa72JigBhUnCkM= From: Alan Tull To: Moritz Fischer , Jonathan Corbet , Randy Dunlap , Dinh Nguyen Cc: Appana Durga Kedareswara Rao , linux-kernel@vger.kernel.org, linux-fpga@vger.kernel.org, linux-doc@vger.kernel.org, Alan Tull , Alan Tull , Matthew Gerlach Subject: [PATCH 1/2] fpga: doc: documentation for FPGA debugfs Date: Wed, 15 Aug 2018 17:09:57 -0500 Message-Id: <20180815220958.3606-1-atull@kernel.org> X-Mailer: git-send-email 2.16.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alan Tull This patch depends on my recently submitted documentation changes ("docs: fpga: document programming fpgas using regions") Document the DebugFS interface for the core FPGA Manager framework. Signed-off-by: Alan Tull Signed-off-by: Matthew Gerlach --- Documentation/driver-api/fpga/fpga-mgr.rst | 38 ++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Documentation/driver-api/fpga/fpga-mgr.rst b/Documentation/driver-api/fpga/fpga-mgr.rst index 576f194..d7ca320 100644 --- a/Documentation/driver-api/fpga/fpga-mgr.rst +++ b/Documentation/driver-api/fpga/fpga-mgr.rst @@ -125,3 +125,41 @@ API for implementing a new FPGA Manager driver .. kernel-doc:: drivers/fpga/fpga-mgr.c :functions: fpga_mgr_unregister + +FPGA Manager DebugFS +-------------------- + +This interface allows the user to program an FPGA from userspace. However, +bridges and soft IP device driver loading/unloading are not handled. This makes +it really easy to mess things up by doing things like reprogramming the hardware +out from under a driver or reprogramming while a bridge is enabled, causing gunk +to go out on a CPU bus. It should go without saying that this interface is for +debug and development only. Not intended for production use. + +Each FPGA gets its own directory such as /fpga_manager/fpga0 and the +files described below. To program the FPGA, write the ``flags`` and/or +``config_complete_timeout_us`` files (as needed), then use either the +``firmware_name`` or ``image`` file to program. + +* ``flags`` - [RW] flags as defined in fpga-mgr.h. For example:: + + $ echo 1 > /sys/kernel/debug/fpga_manager/fpga0/flags + +* ``config_complete_timeout_us`` - [RW] time out in microseconds to wait for the + FPGA to go to operating state after region has been programmed. Not all + low level drivers use this. For example:: + + $ echo 4 > /sys/kernel/debug/fpga_manager/fpga0/config_complete_timeout_us + +* ``firmware_name`` - [RW] Name of an FPGA image firmware file. Writing + initiates an FPGA programming cycle. Note that the image file must be in a + directory on the firmware search path such as /lib/firmware:: + + $ echo image.rbf > /sys/kernel/debug/fpga_manager/fpga0/firmware_name + +* ``image`` - [WO] Raw FPGA image data. Writing the FPGA image data will + initiate an FPGA programming cycle. Data must be written in one chunk, for + example:: + + $ dd bs=10M if=./image.rbf of=/sys/kernel/debug/fpga_manager/fpga0/image + (where image.rbf < 10M) -- 2.7.4