From patchwork Fri Mar 2 07:24:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shubhrajyoti Datta X-Patchwork-Id: 10253545 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A8B7A6037F for ; Fri, 2 Mar 2018 07:24:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84F6B28881 for ; Fri, 2 Mar 2018 07:24:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 797F028887; Fri, 2 Mar 2018 07:24:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E99C528881 for ; Fri, 2 Mar 2018 07:24:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935885AbeCBHYG (ORCPT ); Fri, 2 Mar 2018 02:24:06 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:35159 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934133AbeCBHYF (ORCPT ); Fri, 2 Mar 2018 02:24:05 -0500 Received: by mail-qt0-f194.google.com with SMTP id z14so10839563qti.2; Thu, 01 Mar 2018 23:24:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=S+oGzO169snHi8mgLil1F/9wUx4fTZ6sYXizNBkSL9A=; b=NWytKjNjxUil0AvPssI/aZ97tYG3TL/+5Q/hH+I7Boe8wHdcJfJJ812sWuBWM/4Pzj 6WXjScy+2cY3bk65mqeYmVn94oZF0a99A+vWYbnQUzwb2/86Oqd1MRoli/kekoqoHJoY U2pnKljZIF61zTOB938sbJvC6rfqRHfXru7tdshaScXBactlhgc+te1geWf1B7WklRa5 NuU81XKoWolsMHqNUCsRozdcS6eVW1s+ozbB+I3XewEst9lD3/wk6ZLGooHWOONPr3HY kpKZM28XM7F/NG7pkZ6FcBSHuArlCLTG3PI9thBYRCPcZvDZUiuKIQMARqYLiIGCrbY8 0xdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=S+oGzO169snHi8mgLil1F/9wUx4fTZ6sYXizNBkSL9A=; b=fWNELpNToLryoQ6lF9RQcd3qItp/IsEDpj0napXnE3R6U5F3+I9eQTC6yxcOXfrtPt 9u7aqWfX24Z62U8s0cCMHY68wS2adDlnxd0Ds98gJChEKgNU+iw+FGk02nhCcWhiCBu/ w+5hQzbBeAqZQezZ1v/EcC1mc6UkUhFCGfG2K5qGNAI21aDJx46BDKr2hVyX/oxsYxGl kZa9wXWFj/RnY12Av9Ov45WIrCc4PRwY94OTr2se0bnrdaCIQJniXGdCUf422YT5Bz9X L03b7ILQtsvICziS7A8CoZzGfPX5U+XmRb5Nt2D5zA7Sjg/9Mtv5nTzNIv10d8DkMa61 Irdg== X-Gm-Message-State: AElRT7H+fDBYaznifbC5YCzRy+e2uGzn95kdYFOzSlm3qx4amo0SCjyi pxlGoA8hGmXoAT4aV8CZ7AKDNazWxLsFb4+ili0= X-Google-Smtp-Source: AG47ELueIvIsSFYoae6TmnKtrN+6gei6vNofp+gVXdIODD6maOupwcWTdId4s5uyWgXap3MyKjULPnsxrlSt0D0g85o= X-Received: by 10.200.45.153 with SMTP id p25mr6840099qta.242.1519975444291; Thu, 01 Mar 2018 23:24:04 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.87.4 with HTTP; Thu, 1 Mar 2018 23:24:03 -0800 (PST) In-Reply-To: <20180302050033.v6dvlppskpzht7tf@derp-derp.lan> References: <1519188826-2047-1-git-send-email-shubhrajyoti.datta@gmail.com> <1519188826-2047-2-git-send-email-shubhrajyoti.datta@gmail.com> <20180227002832.GA24387@tyrael.ni.corp.natinst.com> <20180302050033.v6dvlppskpzht7tf@derp-derp.lan> From: Shubhrajyoti Datta Date: Fri, 2 Mar 2018 12:54:03 +0530 Message-ID: Subject: Re: [PATCH 2/2] fpga: reset bridge: Add the reset bridge To: Moritz Fischer Cc: Alan Tull , linux-fpga@vger.kernel.org, Rob Herring , Michal Simek , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , nofooter@xilinx.com, Shubhrajyoti Datta Sender: linux-fpga-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Moritz, >> > >> > Normally, as Moritz is saying, the reset would be handled by the >> > driver for the fabric-based hardware. >> I didnt understand you mean the platform-fpga.c ? > > I don't understand this sentence ;-) I'll try to re-explain: > > Say you have an AXI DMA engine in there that needs a reset to be toggled > after programming the FPGA then you are in either one of these cases: > > a) You're doing a full reprogram of the entire fabric, at which point > you can reset everything by asserting them in the driver like in > drivers/fpga/zynq-fpga.c That would work however I was thinking the reset technically should be in the region and not the fpga manager as it is more related to the region than the manager. Ofcourse manager could proxy for the region. how about [1] > > b) You're doing a partial reconfiguration in which case the regions that > are being reconfigured contain some peripherals you want to selectively > reset. If you need a software reset, the driver for this peripheral can > request a reset through the normal reset API. So if the ip was written in full bitstream case the fpga manager does the request. In PRR case the driver would do it ? I would have preferred to keep that(full or PRR case) agnostic to the driver. > > Am I missing somehting here? Why do you need the bridge to do the reset? > > - Moritz [1] if (IS_ERR(region)) { @@ -273,6 +276,15 @@ static int fpga_region_program_fpga(struct fpga_region *region, goto err_put_br; } + rstc = of_reset_control_array_get(dev->of_node, false, true); + if (IS_ERR(rstc)) { + goto err_put_br; + } + + reset_control_reset(rstc); + reset_control_put(rstc); + fpga_bridges_put(®ion->bridge_list); fpga_mgr_put(mgr); fpga_region_put(region); --- To unsubscribe from this list: send the line "unsubscribe linux-fpga" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Documentation/devicetree/bindings/fpga/fpga-region.txt b/Documentation/devicetree/bindings/fpga/fpga-region.txt index 6db8aed..955a863 100644 --- a/Documentation/devicetree/bindings/fpga/fpga-region.txt +++ b/Documentation/devicetree/bindings/fpga/fpga-region.txt @@ -196,6 +196,7 @@ Optional properties: - config-complete-timeout-us : The maximum time in microseconds time for the FPGA to go to operating mode after the region has been programmed. - child nodes : devices in the FPGA after programming. +- resets : Phandle and reset specifier for this region In the example below, when an overlay is applied targeting fpga-region0, fpga_mgr is used to program the FPGA. Two bridges are controlled during diff --git a/drivers/fpga/fpga-region.c b/drivers/fpga/fpga-region.c index 58789b9..8c87a6b 100644 --- a/drivers/fpga/fpga-region.c +++ b/drivers/fpga/fpga-region.c @@ -25,6 +25,7 @@ #include #include #include +#include /** * struct fpga_region - FPGA Region structure @@ -235,6 +236,8 @@ static int fpga_region_program_fpga(struct fpga_region *region, { struct fpga_manager *mgr; int ret; + struct device *dev = ®ion->dev; + struct reset_control *rstc; region = fpga_region_get(region);