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: 37455 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3ED982057E for ; Tue, 16 Sep 2014 11:55:31 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id bs8sf2987523wib.6 for ; Tue, 16 Sep 2014 04:55:26 -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=S5cTkW/TI58aB+OxECm5yNEYD3v3jEiHNqzzztA93K8=; b=D9AXCuoLlz0u9YiIR61hJf2Jwdz6yzU0M6F9xNUQdsx4z0tbSnemo9qa1rwY8aG/8s 0Sf9/NR4jiYdKzaBbZEWnWoQpoMenYvCiFpELOyGj7xuny4XEXCAfKIKuiFGJlbF9kZH fGzBsp9fqpia4yVRj6hYBd/ddVATKthrNfOdAU6580gzEknyZ8I1dJTxjIKS+KIzYtwW dWhqSpOaHDrif4oPSlfG1yvlRZLusBgPu5fIlzkA4ffKxzysfR5BV/NJaeSpx9XsGiES qanTTnNDv5uIqZz7ju1J7/tgJDYamWTyts52dkqeSISebM1B7SCpx3TVWG1o1L/ExN7m 58nQ== X-Gm-Message-State: ALoCoQm+6Tjinq+pMHPJ9KYI1TjVOjyivoKUb9ZHG/NR03RfBmDJVQOBfRqvKA1+dS/Cq5izwHe/ X-Received: by 10.112.163.104 with SMTP id yh8mr8301190lbb.5.1410868526210; Tue, 16 Sep 2014 04:55:26 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.4 with SMTP id lk4ls465104lac.41.gmail; Tue, 16 Sep 2014 04:55:26 -0700 (PDT) X-Received: by 10.112.63.136 with SMTP id g8mr10210415lbs.98.1410868525986; Tue, 16 Sep 2014 04:55:25 -0700 (PDT) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com [209.85.217.180]) by mx.google.com with ESMTPS id mk4si23851485lbc.48.2014.09.16.04.55.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Sep 2014 04:55:25 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id b12so6296819lbj.39 for ; Tue, 16 Sep 2014 04:55:25 -0700 (PDT) X-Received: by 10.152.7.8 with SMTP id f8mr35776669laa.27.1410868525092; Tue, 16 Sep 2014 04:55:25 -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.112.130.169 with SMTP id of9csp374310lbb; Tue, 16 Sep 2014 04:55:24 -0700 (PDT) X-Received: by 10.68.203.198 with SMTP id ks6mr15521850pbc.140.1410868522046; Tue, 16 Sep 2014 04:55:22 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id zp8si29178866pac.130.2014.09.16.04.55.21 for ; Tue, 16 Sep 2014 04:55:21 -0700 (PDT) Received-SPF: none (google.com: linux-samsung-soc-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 S1754339AbaIPLzP (ORCPT + 6 others); Tue, 16 Sep 2014 07:55:15 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:18278 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754341AbaIPLzH (ORCPT ); Tue, 16 Sep 2014 07:55:07 -0400 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-samsung-soc@vger.kernel.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 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 , Will Deacon , David Wodhouse , Inki Dae , Kukjin Kim , Tomasz Figa , Kyungmin Park 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= Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-samsung-soc@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.217.180 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 | 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)