Received: by 10.223.176.5 with SMTP id f5csp166117wra; Tue, 30 Jan 2018 09:35:41 -0800 (PST) X-Google-Smtp-Source: AH8x224x0WjxZc+hBWt5PoMHGlzGdNQ8DuQ9Ny642MyN2/JKNKAl/OyMkyzXuby51EetavPiRPFW X-Received: by 2002:a17:902:bcc5:: with SMTP id o5-v6mr26290437pls.67.1517333741193; Tue, 30 Jan 2018 09:35:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517333741; cv=none; d=google.com; s=arc-20160816; b=fwmXYxCv9e/Z5rDU57GGmF55yjfCiMY7TENW9aFhCqKnwkJRf+xRoNEwMMpE8ym1OR ASp4oCg6g2DN2+NzLk7hB60Hp2b3fbY7iX56r/cXio/1ap0rVBs860M0ig+QxpVFAXwP uSMGOg1x9zDB3uKENI0iJ8MjkPZjOlCPxiUo42196gMiEe7WQABvy2aqMIi+J6YHlRm4 7Awtgd5UY+swqpaklytPCjJvAylTzNRmRJO1OZx+dmkqtjumroK6KO2m3JYH3n2XPLJh b05+RDzgxfM6/WkI5nBm20xeZBcmS4CMh+XmjtN4rPc24IMO6XpU4fIhN4bo6ZNEV7cd 3dLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=ZzdWxU7qEOxN3HVFt3Th1Q7x4Vx0pNNyE9xbEURCeC0=; b=sxFNxnDBLXJdgaMYWgwzJIgGQV7piTSxUeFc5Df9mjUC6WQAj29ORkAzhxiTjX3WVJ ZSxyFp8nMPWLgPPNbplkFgkG0ZoyQoJerslqeeWyOx75nuh4mdLVbdmBq2lJw8Zt0Myk 6xSPDantHVl5SdhfzfWfhDJ4A+TfFlcYU+VamsDV36/MSkyAUyhF7sKr7lRvomGeYj58 jOCn+Zw7wDW0Ay7k4uullHHijkhvGiT4QnHA++5pFOAYBPEzBKoCYne+jFaM7byQB/dy 4hpbXZodiOVJZVg8M1Zdl1ZiQpzlXoiA4Q/v8/+ksgpNY0DX/MouSHhwzFcP+FBWJ8pM dAzw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u1-v6si4258916pls.210.2018.01.30.09.35.26; Tue, 30 Jan 2018 09:35:41 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753180AbeA3RFT (ORCPT + 99 others); Tue, 30 Jan 2018 12:05:19 -0500 Received: from mail-oi0-f65.google.com ([209.85.218.65]:34975 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751474AbeA3RFR (ORCPT ); Tue, 30 Jan 2018 12:05:17 -0500 Received: by mail-oi0-f65.google.com with SMTP id b11so8330684oif.2; Tue, 30 Jan 2018 09:05:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ZzdWxU7qEOxN3HVFt3Th1Q7x4Vx0pNNyE9xbEURCeC0=; b=jlI5a5EMqmW/JdfWlebU5d/Rp5O8BV3AuooHCKoX7isnUdSu4F7/RWhjDBGVDRt/rq t+fbvSF3A1rtk5uJ4u8rpppoGDLTux/wM36K4BB495P32xJ5do0iP242zal1sVjgjlRu NUOqNpq30wCJUPwRHrXlAKc58LDhGPyt5SgWVlcFz1ZvXVZPn3Rx/d7eHKdsu9bWBwTN O+9j2vO6ZxX7mrGIU7ifYYNsfW0ieKBQhgt6VIHxvZ8aQaTekJtqHuKdwGq2Bc96cqzn Hyq7qCqUtB9Q9sxUUaTxnQxXyhxKwE/cX0x1mxu9RcerLJgDbLhebQre3BNdNvd8Qhtj PmXw== X-Gm-Message-State: AKwxytfIhxyuG4qNitut7VS2K3knuik/gtrWGFyzSlFw9BQ43FKPAfCc hSs26tYJuvseGgR5cCXX9Q== X-Received: by 10.202.197.70 with SMTP id v67mr3308269oif.218.1517331917150; Tue, 30 Jan 2018 09:05:17 -0800 (PST) Received: from localhost (216-188-254-6.dyn.grandenetworks.net. [216.188.254.6]) by smtp.gmail.com with ESMTPSA id t83sm7967066oij.32.2018.01.30.09.05.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 Jan 2018 09:05:16 -0800 (PST) Date: Tue, 30 Jan 2018 11:05:15 -0600 From: Rob Herring To: Jeffy Chen Cc: linux-kernel@vger.kernel.org, jcliang@chromium.org, robin.murphy@arm.com, xxm@rock-chips.com, tfiga@chromium.org, devicetree@vger.kernel.org, Heiko Stuebner , linux-rockchip@lists.infradead.org, iommu@lists.linux-foundation.org, Mark Rutland , Joerg Roedel , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v5 08/13] iommu/rockchip: Control clocks needed to access the IOMMU Message-ID: <20180130170515.3g6wtadqgmehxh5b@rob-hp-laptop> References: <20180124103516.2571-1-jeffy.chen@rock-chips.com> <20180124103516.2571-9-jeffy.chen@rock-chips.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180124103516.2571-9-jeffy.chen@rock-chips.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 24, 2018 at 06:35:11PM +0800, Jeffy Chen wrote: > From: Tomasz Figa > > Current code relies on master driver enabling necessary clocks before > IOMMU is accessed, however there are cases when the IOMMU should be > accessed while the master is not running yet, for example allocating > V4L2 videobuf2 buffers, which is done by the VB2 framework using DMA > mapping API and doesn't engage the master driver at all. > > This patch fixes the problem by letting clocks needed for IOMMU > operation to be listed in Device Tree and making the driver enable them > for the time of accessing the hardware. > > Signed-off-by: Jeffy Chen > Signed-off-by: Tomasz Figa > --- > > Changes in v5: > Use clk_bulk APIs. > > Changes in v4: None > Changes in v3: None > Changes in v2: None > > .../devicetree/bindings/iommu/rockchip,iommu.txt | 8 +++ Please split binding patches to a separate patch. > drivers/iommu/rockchip-iommu.c | 74 ++++++++++++++++++++-- > 2 files changed, 76 insertions(+), 6 deletions(-) > > diff --git a/Documentation/devicetree/bindings/iommu/rockchip,iommu.txt b/Documentation/devicetree/bindings/iommu/rockchip,iommu.txt > index 2098f7732264..33dd853359fa 100644 > --- a/Documentation/devicetree/bindings/iommu/rockchip,iommu.txt > +++ b/Documentation/devicetree/bindings/iommu/rockchip,iommu.txt > @@ -14,6 +14,13 @@ Required properties: > "single-master" device, and needs no additional information > to associate with its master device. See: > Documentation/devicetree/bindings/iommu/iommu.txt > +Optional properties: > +- clocks : A list of master clocks requires for the IOMMU to be accessible > + by the host CPU. The number of clocks depends on the master > + block and might as well be zero. See [1] for generic clock > + bindings description. Hardware blocks don't have a variable number of clock connections. This needs to be a defined number of clocks (per compatible string if there are different implementations with different # of clocks). > + > +[1] Documentation/devicetree/bindings/clock/clock-bindings.txt > > Optional properties: > - rockchip,disable-mmu-reset : Don't use the mmu reset operation. > @@ -27,5 +34,6 @@ Example: > reg = <0xff940300 0x100>; > interrupts = ; > interrupt-names = "vopl_mmu"; > + clocks = <&cru ACLK_VOP1>, <&cru DCLK_VOP1>, <&cru HCLK_VOP1>; > #iommu-cells = <0>; > };