From patchwork Wed Nov 19 11:15:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 41143 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6943020CBB for ; Wed, 19 Nov 2014 11:16:51 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id f15sf253707lbj.11 for ; Wed, 19 Nov 2014 03:16:50 -0800 (PST) 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=ZgT+tt8XIX1FEOrMwrG3K04MIRg7aziTN+F9jTYubOU=; b=gCDGzt+SyqTuLrbLxkFEzMpOIYKpbRpnsyPG25ch8qggDLKXrEk/qO1afuEP/KZqb7 Ggp5wkQw6D7+IzxNmvdz1WqDQ4Pbxim6Awoc7pFW2M/fdj/0dVT0yPHI1k4k+L52gtJ9 ZwL/iQP/xkn0ytyjcqc/DeWs8OlOfm3DBq3FAk9EqPItBpq7BqibpJMjT5ruxwfg3oK3 Fg0CMxeApAbfhUOFz5dfEd96b0gY8JledyEdQ7j32FNseWNQ66E5rnTUh1vMz0BdzpKF JuumII0kIy8gD+Ha5ovlHBX8e1wz7WoXy2RqXFsewm8DnJE9Se6NjttpwJVXtJtMs34d XcNw== X-Gm-Message-State: ALoCoQkTY69rxdGxcSeHKkrbiYsS4vp8zNajsiR3NQCEHnLPdPkSTNcPXzHChOaW0VxQe/QHDvbz X-Received: by 10.112.62.226 with SMTP id b2mr337383lbs.11.1416395810372; Wed, 19 Nov 2014 03:16:50 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.168 with SMTP id 8ls287205lav.47.gmail; Wed, 19 Nov 2014 03:16:50 -0800 (PST) X-Received: by 10.152.26.131 with SMTP id l3mr4840195lag.49.1416395810224; Wed, 19 Nov 2014 03:16:50 -0800 (PST) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id at1si1497984lbc.18.2014.11.19.03.16.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Nov 2014 03:16:50 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by mail-lb0-f171.google.com with SMTP id b6so299556lbj.16 for ; Wed, 19 Nov 2014 03:16:50 -0800 (PST) X-Received: by 10.153.7.170 with SMTP id dd10mr4798708lad.44.1416395810110; Wed, 19 Nov 2014 03:16:50 -0800 (PST) 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.184.201 with SMTP id ew9csp64322lbc; Wed, 19 Nov 2014 03:16:49 -0800 (PST) X-Received: by 10.68.98.196 with SMTP id ek4mr19486169pbb.150.1416395803320; Wed, 19 Nov 2014 03:16:43 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xo9si2087857pbc.210.2014.11.19.03.16.42 for ; Wed, 19 Nov 2014 03:16:43 -0800 (PST) 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 S1754837AbaKSLQh (ORCPT + 4 others); Wed, 19 Nov 2014 06:16:37 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:23355 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754598AbaKSLQg (ORCPT ); Wed, 19 Nov 2014 06:16:36 -0500 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 <0NFA00JS3A4ERH40@mailout3.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Wed, 19 Nov 2014 11:19:27 +0000 (GMT) X-AuditID: cbfec7f5-b7f956d000005ed7-e1-546c7c12d67a Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 98.B2.24279.21C7C645; Wed, 19 Nov 2014 11:16:34 +0000 (GMT) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync1.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NFA00GC59YMTL30@eusync1.samsung.com>; Wed, 19 Nov 2014 11:16:34 +0000 (GMT) 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 v3 16/19] iommu: exynos: document internal structures Date: Wed, 19 Nov 2014 12:15:45 +0100 Message-id: <1416395748-10731-17-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1416395748-10731-1-git-send-email-m.szyprowski@samsung.com> References: <1416395748-10731-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFLMWRmVeSWpSXmKPExsVy+t/xy7pCNTkhBpMf8Vj8nXSM3WLiysnM FpPuT2CxWLDf2qJz9gZ2i94FV9kszja9YbfonLiE3eLLlYdMFpseX2O1mHF+H5PF2iN32S1O Xf/MZvGv9yCjxf89O9gtjjzczW6xatcfRovbv/ksXn48weIg7PHk4DwmjzXz1jB6/P41idFj 56y77B6zO2ayemxeoeWxaVUnm8fmJfUet/89ZvaYfGM5o8eVE02sHr3N79g8+rasYvT4vEku gC+KyyYlNSezLLVI3y6BK+P6iemMBSckK+ZMWsbewPhepIuRk0NCwETi49IXzBC2mMSFe+vZ uhi5OIQEljJK3O/6wgTh9DFJXGudyQRSxSZgKNH1tosNxBYRyJd4sfcvC4jNLPCGReLeJkMQ W1jAVWLOmstgU1kEVCUO370K1ssr4Clx+usrNohtchL/X64AinNwcALFr78AGyMk4CHRNH0d 6wRG3gWMDKsYRVNLkwuKk9JzjfSKE3OLS/PS9ZLzczcxQuLj6w7GpcesDjEKcDAq8fA2FOeE CLEmlhVX5h5ilOBgVhLhLS4ECvGmJFZWpRblxxeV5qQWH2Jk4uCUamC8xO+xk0OTQ5ZZY13X m2t7+T3fXOWbvjc27u4vo67gU8xMbAx3WEJC+pS1WF51hKvIKR+bkHDJmWNbrtXMFexGEetS r9o5LHmqzfVu8SHx5rc2s/v3dIq9eRqw67/YPI6nrv5l6Z9+yIRaJC1TTm26kiNyu7Fv1sbb /14ryko2/eROv5mm067EUpyRaKjFXFScCAB3d3HBbQIAAA== 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.171 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 4c9b9b9e099f..a5b32cdeec2d 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)