From patchwork Wed Dec 26 11:27:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prathyush K X-Patchwork-Id: 1910961 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id D6F0B3FC85 for ; Wed, 26 Dec 2012 11:11:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D8725E60B6 for ; Wed, 26 Dec 2012 03:11:27 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by gabe.freedesktop.org (Postfix) with ESMTP id DC196E60C9 for ; Wed, 26 Dec 2012 03:05:28 -0800 (PST) Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MFM00JGIXGI8NA0@mailout4.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 26 Dec 2012 20:05:25 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.123]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 84.8D.01231.5F9DAD05; Wed, 26 Dec 2012 20:05:25 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-46-50dad9f52930 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 64.8D.01231.5F9DAD05; Wed, 26 Dec 2012 20:05:25 +0900 (KST) Received: from chrome-ubuntu.sisodomain.com ([107.108.73.106]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MFM0029MXGTEU90@mmp1.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 26 Dec 2012 20:05:25 +0900 (KST) From: Prathyush K To: dri-devel@lists.freedesktop.org Subject: [PATCH 4/8] drm/exynos: fimd: clear channel before enabling iommu Date: Wed, 26 Dec 2012 06:27:41 -0500 Message-id: <1356521265-22749-5-git-send-email-prathyush.k@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1356521265-22749-1-git-send-email-prathyush.k@samsung.com> References: <1356521265-22749-1-git-send-email-prathyush.k@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrLLMWRmVeSWpSXmKPExsWyRsSkWvfrzVsBBr+3WVhc+fqezYHR4373 caYAxigum5TUnMyy1CJ9uwSujC2zlzIXbBaoWLrkFnMD43beLkZODgkBE4mNL66wQ9hiEhfu rWfrYuTiEBJYyihxaNp+JpiibyevMkMkFjFKbP61kAXC2cgksejBG7AqNgFtiV9z7rKC2CIC yhJ/J65iBLGZBSQkjrSfZQOxhQW8JOYv+w22jkVAVWLjzA9gNq+Au8TaW82MENvkJD7seQQW 5xTwkLiwcQ/YTCGgmrYHH1ghegUkvk0+BHQEB1C9rMSmA2DHSQhcZ5P4/PYFG8QcSYmDK26w TGAUXsDIsIpRNLUguaA4KT3XUK84Mbe4NC9dLzk/dxMjMAxP/3smtYNxZYPFIUYBDkYlHt6N 328GCLEmlhVX5h5ilOBgVhLhVVh1K0CINyWxsiq1KD++qDQntfgQow/QJROZpUST84ExklcS b2hsYm5qbGppZGRmaopDWEmct9kjJUBIID2xJDU7NbUgtQhmHBMHp1QD40Shpom1EboKs1bq Ppl69WyaQG3KqlsVapp7/fZOFznErpKpMZH51Our34+HhehXWSue4jxwjVl5c8objt3RhjvX FC5fWLy3tdKy7vTZZcf/f4/S+ahlHPj/8rYFBxiMeafNSDKt81I49nLVS6HKDR+23LV/+Xb1 /g+ca6yUXLUWLPjAmLKY1VKJpTgj0VCLuag4EQAnyqUvcAIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphkeLIzCtJLcpLzFFi42I5/e+xgO7Xm7cCDHq3GVhc+fqezYHR4373 caYAxqgGRpuM1MSU1CKF1Lzk/JTMvHRbJe/geOd4UzMDQ11DSwtzJYW8xNxUWyUXnwBdt8wc oLFKCmWJOaVAoYDE4mIlfTtME0JD3HQtYBojdH1DguB6jAzQQMIaxowts5cyF2wWqFi65BZz A+N23i5GTg4JAROJbyevMkPYYhIX7q1n62Lk4hASWMQosfnXQhYIZyOTxKIHb5hAqtgEtCV+ zbnLCmKLCChL/J24ihHEZhaQkDjSfpYNxBYW8JKYv+w3O4jNIqAqsXHmBzCbV8BdYu2tZkaI bXISH/Y8AotzCnhIXNi4B2ymEFBN24MPrBMYeRcwMqxiFE0tSC4oTkrPNdQrTswtLs1L10vO z93ECA7yZ1I7GFc2WBxiFOBgVOLh3fj9ZoAQa2JZcWXuIUYJDmYlEV6FVbcChHhTEiurUovy 44tKc1KLDzH6AF01kVlKNDkfGIF5JfGGxibmpsamliYWJmaWOISVxHmbPVIChATSE0tSs1NT C1KLYMYxcXBKNTBaTbWTa2CbzWpWxbFYMXn5ZtNY/XlZC4/qGKidDpjTHpcevDT02F2O50c5 FVJ2SqneC+CrWDv9mUnNVpFVXbwT9h/IS7/Iunmf8gLNH4ovDsq0z9p9PVyh2iqB6UvtitSr U+Q27Ar4dqTZbrUmR+z1DttPRyy2rbu64q6dz8lTPUL+GQk+0+4rsRRnJBpqMRcVJwIANw/2 r58CAAA= X-CFilter-Loop: Reflected X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org From: Akshu Agrawal If any fimd channel was already active, initializing iommu will result in a PAGE FAULT (e.g. u-boot could have turned on the display and not disabled it before the kernel starts). This patch checks if any channel is active before initializing iommu and disables it. Signed-off-by: Akshu Agrawal Signed-off-by: Prathyush K --- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index f88eaa4..3aeedf5 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -733,6 +733,28 @@ out: return IRQ_HANDLED; } +static void fimd_clear_channel(struct device *dev) +{ + struct fimd_context *ctx = get_fimd_context(dev); + int win, ch_enabled = 0; + + DRM_DEBUG_KMS("%s\n", __FILE__); + + /* Check if any channel is enabled */ + for (win = 0; win < WINDOWS_NR; win++) { + u32 val = readl(ctx->regs + SHADOWCON); + if (val & SHADOWCON_CHx_ENABLE(win)) { + val &= ~SHADOWCON_CHx_ENABLE(win); + writel(val, ctx->regs + SHADOWCON); + ch_enabled = 1; + } + } + + /* Wait for vsync, as disable channel takes effect at next vsync */ + if (ch_enabled) + fimd_wait_for_vblank(dev); +} + static int fimd_subdrv_probe(struct drm_device *drm_dev, struct device *dev) { DRM_DEBUG_KMS("%s\n", __FILE__); @@ -755,9 +777,14 @@ static int fimd_subdrv_probe(struct drm_device *drm_dev, struct device *dev) drm_dev->vblank_disable_allowed = 1; /* attach this sub driver to iommu mapping if supported. */ - if (is_drm_iommu_supported(drm_dev)) + if (is_drm_iommu_supported(drm_dev)) { + /* + * If any channel is already active, iommu will throw + * a PAGE FAULT when enabled. So clear any channel if enabled. + */ + fimd_clear_channel(dev); drm_iommu_attach_device(drm_dev, dev); - + } return 0; }