From patchwork Tue Sep 16 11:54:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 4917631 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C9090BEEA6 for ; Tue, 16 Sep 2014 12:01:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 72C1C200CC for ; Tue, 16 Sep 2014 12:01:24 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 114DD201ED for ; Tue, 16 Sep 2014 12:01:23 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XTrPJ-0000fc-U5; Tue, 16 Sep 2014 11:58:53 +0000 Received: from mailout3.w1.samsung.com ([210.118.77.13]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XTrM1-00041i-Sm for linux-arm-kernel@lists.infradead.org; Tue, 16 Sep 2014 11:55:31 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NBZ00GDOT8KR3B0@mailout3.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 16 Sep 2014 12:57:56 +0100 (BST) X-AuditID: cbfec7f5-b7f776d000003e54-0b-54182519659d Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 0A.9C.15956.91528145; Tue, 16 Sep 2014 12:55:05 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NBZ00CMIT3CL960@eusync2.samsung.com>; Tue, 16 Sep 2014 12:55:05 +0100 (BST) From: Marek Szyprowski To: iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 15/18] iommu: exynos: document internal structures Date: Tue, 16 Sep 2014 13:54:42 +0200 Message-id: <1410868485-4143-16-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1410868485-4143-1-git-send-email-m.szyprowski@samsung.com> References: <1410868485-4143-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFLMWRmVeSWpSXmKPExsVy+t/xK7qSqhIhBns2cFv8nXSM3WLiysnM FpPuT2CxWLDf2qJz9gZ2i94FV9kszja9YbfonLiE3eLLlYdMFpseX2O1mHF+H5PF2iN32S1O Xf/MZvGv9yCjxf89O9gtjjzczW6xatcfRovbv/ksXn48weIg7PHk4DwmjzXz1jB6/P41idFj 56y77B6zO2ayemxeoeWxaVUnm8fmJfUet/89ZvaYfGM5o8eVE02sHr3N79g8+rasYvT4vEku gC+KyyYlNSezLLVI3y6BK2P9/OSCE5IVLa8uMTYwvhfpYuTkkBAwkZiy5CczhC0mceHeerYu Ri4OIYGljBKb5/xigXD6mCTetDYygVSxCRhKdL3tYgOxRQTyJV7s/csCYjMLvGGRuLfJEMQW FnCVmNuyhxHEZhFQldjYM5sVxOYV8JDYdmUCI8Q2OYn/L1eAzeQEik9uewJ2hZCAu8THb6eY JjDyLmBkWMUomlqaXFCclJ5rpFecmFtcmpeul5yfu4kREh9fdzAuPWZ1iFGAg1GJhzfjn3iI EGtiWXFl7iFGCQ5mJRFeDUWJECHelMTKqtSi/Pii0pzU4kOMTBycUg2Mkw1CZHVUbul9Mnza OFtUlOHbjldMG4vExVL/sa+64PPk/4v7ua1eBk6q0kca7cTu+bFyFBqrvlxw96qj603Fv2uW +VlmyviofmE0sPy3omRv1lP3LTl/p3bWPn1iox8YW7F6w2SmBd8Sl7t8Ne83N5XZqvGPM2rS DHcN1rWKM/nLtktPmCmhxFKckWioxVxUnAgAsl9YoW0CAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140916_045530_124911_343FA205 X-CRM114-Status: GOOD ( 14.00 ) X-Spam-Score: -5.7 (-----) Cc: Rob Herring , Thierry Reding , Shaik Ameer Basha , Arnd Bergmann , Inki Dae , Joerg Roedel , Will Deacon , Tomasz Figa , linaro-mm-sig@lists.linaro.org, Kyungmin Park , Kukjin Kim , Laurent Pinchart , Olof Johansson , Cho KyongHo , David Wodhouse , Marek Szyprowski X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a few words of comment to all internal structures used by the driver. Signed-off-by: Marek Szyprowski --- drivers/iommu/exynos-iommu.c | 49 +++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index ae61d0680b9a..a75b06365f97 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -184,32 +184,49 @@ 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; - spinlock_t lock; - struct iommu_domain *domain; - struct list_head domain_node; - struct list_head owner_node; - phys_addr_t pgtable; - int version; + 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 */ + 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 */ }; static bool set_sysmmu_active(struct sysmmu_drvdata *data)