From patchwork Tue Aug 5 10:47:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 34918 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oi0-f70.google.com (mail-oi0-f70.google.com [209.85.218.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ACBBA2397D for ; Tue, 5 Aug 2014 10:49:37 +0000 (UTC) Received: by mail-oi0-f70.google.com with SMTP id u20sf2823522oif.9 for ; Tue, 05 Aug 2014 03:49:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=qzU/7xOkkwnMy7oKo3uWEzsZD0dSpfrlXvFVkbyaTBc=; b=R0w7zJw9GulxFpV+/cCB6aOs7Hl5LaA1f6kb+q5XFmXsfILeaODXLkCV7z7P+S25SV dw8WduwahdrOejUhlU3FZL9jlGKSCk/30e1F8EcHjzBUUzEQUf96j9OxcXaPYFmUu729 eg25oWj67XVqWq7PVv5WPYHBtBPjUtCJpeOX2/v2FFCuOJaVmNkMOqV0mO5OCOlF6qGl kx3WBwKdVN9wV/GwgL3G43UG5xZpAA6QMGe/W7NGfeBEY6WlNKe/aOc25y+znzy2hES3 TikwtVKpbUxOQCEkpoHhob8pLMPMaEfpqPkQfrW9tHZi8Kg9udwPX4elYOJTl/5xJeaZ eJmA== X-Gm-Message-State: ALoCoQkjmzPaPOrHrxiou3NYBEv+fLcLjyhqSxzrm5A2dA1E+Zf3CC5JaqMcdU5rZstcU5jiMMBU X-Received: by 10.43.149.193 with SMTP id kl1mr2138172icc.5.1407235776339; Tue, 05 Aug 2014 03:49:36 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.106.139 with SMTP id e11ls187909qgf.36.gmail; Tue, 05 Aug 2014 03:49:36 -0700 (PDT) X-Received: by 10.52.5.40 with SMTP id p8mr2033558vdp.28.1407235776199; Tue, 05 Aug 2014 03:49:36 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id 7si783807vcu.41.2014.08.05.03.49.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 05 Aug 2014 03:49:36 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id hq11so1110094vcb.10 for ; Tue, 05 Aug 2014 03:49:36 -0700 (PDT) X-Received: by 10.221.42.135 with SMTP id ty7mr2443202vcb.14.1407235776107; Tue, 05 Aug 2014 03:49:36 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp374578vcb; Tue, 5 Aug 2014 03:49:35 -0700 (PDT) X-Received: by 10.70.128.105 with SMTP id nn9mr413629pdb.23.1407235775175; Tue, 05 Aug 2014 03:49:35 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a13si1542429pbw.101.2014.08.05.03.49.34 for ; Tue, 05 Aug 2014 03:49:35 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755197AbaHEKtW (ORCPT + 21 others); Tue, 5 Aug 2014 06:49:22 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:9371 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755103AbaHEKtN (ORCPT ); Tue, 5 Aug 2014 06:49:13 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N9T00JLJY1IWY90@mailout2.w1.samsung.com>; Tue, 05 Aug 2014 11:48:54 +0100 (BST) X-AuditID: cbfec7f5-b7f776d000003e54-c3-53e0b6a80f85 Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 35.EC.15956.8A6B0E35; Tue, 05 Aug 2014 11:49:12 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync3.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0N9T0057MY17SE80@eusync3.samsung.com>; Tue, 05 Aug 2014 11:49:12 +0100 (BST) From: Marek Szyprowski To: iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Marek Szyprowski , linaro-mm-sig@lists.linaro.org, Arnd Bergmann , Shaik Ameer Basha , Cho KyongHo , Joerg Roedel , Thierry Reding , Olof Johansson , Laurent Pinchart , Rob Herring , Greg Kroah-Hartman , "Rafael J. Wysocki" , Inki Dae , Kukjin Kim , Sylwester Nawrocki , Tomasz Figa , Kyungmin Park Subject: [PATCH 27/29] iommu: exynos: document internal structures Date: Tue, 05 Aug 2014 12:47:55 +0200 Message-id: <1407235677-26324-28-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1407235677-26324-1-git-send-email-m.szyprowski@samsung.com> References: <1407235677-26324-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBLMWRmVeSWpSXmKPExsVy+t/xq7ortj0INnhwS9zi76Rj7BbNi9ez WUy6P4HFYsF+a4vO2RvYLXoXXGWzONv0ht2ic+ISdosvVx4yWWx6fI3V4vKuOWwWM87vY7JY e+Quu8Wp65/ZLP71HmS0OHP6EqvF/z072C0Ov2lntTjycDe7xapdfxgtbv/mcxD1eHJwHpPH 71+TGD12zrrL7jG7Yyarx6ZVnWwe++euYffYvKTe4/a/x8wek28sZ/S4cqKJ1aO3+R2bx5ar 7SwefVtWMXp83iQXwBfFZZOSmpNZllqkb5fAlbHj03+mgl8yFX+nnGdsYDwh3sXIySEhYCKx bvdSFghbTOLCvfVsXYxcHEICSxkl2uecZYVw+pgkHi+exQhSxSZgKNH1tgusSkSgl1Giv+kH E4jDLLCOVWJ/73WwWcICThIL905jA7FZBFQlvl3byAxi8wp4Siw81sUMsU9O4v/LFUwgNidQ /PDNA6wgtpCAh8TPDWvYJzDyLmBkWMUomlqaXFCclJ5rpFecmFtcmpeul5yfu4kREjtfdzAu PWZ1iFGAg1GJh1dh791gIdbEsuLK3EOMEhzMSiK8EmseBAvxpiRWVqUW5ccXleakFh9iZOLg lGpgPDu7ftbxMxcn82dGqqsu/ZL/0rR1x5NjP430PfmubKu4tkvCYcUuvxf2vVZCnF0y/P0z dAx0l9T/MGj7If1ywse7joZf2e9/d7Tp1r3Hs/HojRPSMhrTOsKfxW5r+GjVdZjVJXWHR1+D ZNq5hy6LnV3Dp5/W5dqx/+qT1Af+pxa5PYu+6/iES4mlOCPRUIu5qDgRADTWikJ7AgAA Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: m.szyprowski@samsung.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add a few words of comment to all internal structures used by the driver. Signed-off-by: Marek Szyprowski --- drivers/iommu/exynos-iommu.c | 59 ++++++++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 7600861..78ce618 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -189,37 +189,54 @@ static char *sysmmu_fault_name[SYSMMU_FAULTS_NUM] = { "UNKNOWN FAULT" }; -/* attached to dev.archdata.iommu of the master device */ +/* + * This structure is attached to dev.archdata.iommu of the master device + * on device add, contains a list of SYSMMU controllers defined by device tree, + * which are bound to given master device. It is usually referenced by 'owner' + * pointer. + */ struct exynos_iommu_owner { - struct list_head clients; + struct list_head clients; /* list of sysmmu_drvdata.owner_node */ }; +/* + * This structure is stored in ->priv field of generic struct iommu_domain, + * contains list of SYSMMU controllers from all master devices, which has been + * attached to this domain and page tables of IO address space defined by this + * domain. It is usually referenced by 'domain' pointer. + */ struct exynos_iommu_domain { - struct list_head clients; /* list of sysmmu_drvdata.node */ + struct list_head clients; /* list of sysmmu_drvdata.domain_node */ sysmmu_pte_t *pgtable; /* lv1 page table, 16KB */ short *lv2entcnt; /* free lv2 entry counter for each section */ - spinlock_t lock; /* lock for this structure */ + spinlock_t lock; /* lock for modyfying list of clients */ spinlock_t pgtablelock; /* lock for modifying page table @ pgtable */ }; +/* + * This structure hold all data of a single SYSMMU controller, this includes + * hw resources like registers and clocks, pointers and list nodes to connect + * it to all other structures, internal state and parameters read from device + * tree. It is usually referenced by 'data' pointer. + */ struct sysmmu_drvdata { - struct device *sysmmu; /* System MMU's device descriptor */ - struct device *master; /* Owner of system MMU */ - void __iomem *sfrbase; - struct clk *clk; - struct clk *clk_master; - int activations; - int suspended; - spinlock_t lock; - struct iommu_domain *domain; - struct list_head domain_node; - struct list_head owner_node; - phys_addr_t pgtable; - int version; - const char *name; - dma_addr_t base; - size_t size; - struct notifier_block pm_notifier; + struct device *sysmmu; /* SYSMMU controller device */ + struct device *master; /* master device (owner of given SYSMMU) */ + void __iomem *sfrbase; /* our registers */ + struct clk *clk; /* SYSMMU's clock */ + struct clk *clk_master; /* master's device clock */ + int activations; /* number of calls to sysmmu_enable */ + int suspended; /* status of the controller (managed by runtime pm) */ + spinlock_t lock; /* lock for modyfying enable/disable state */ + struct iommu_domain *domain; /* domain we belong to */ + struct list_head domain_node; /* node for domain clients list */ + struct list_head owner_node; /* node for owner clients list */ + phys_addr_t pgtable; /* assigned page table structure */ + int version; /* our version */ + const char *name; /* our name from device tree */ + dma_addr_t base; /* base addres of IO address space define in DT */ + size_t size; /* size of IO address space define in DT */ + struct notifier_block pm_notifier; /* notifier for pm domain on/off */ }; static bool set_sysmmu_active(struct sysmmu_drvdata *data)