From patchwork Mon Jun 11 06:48:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10457217 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ED11060234 for ; Mon, 11 Jun 2018 06:48:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9D4C27F93 for ; Mon, 11 Jun 2018 06:48:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE2F327F98; Mon, 11 Jun 2018 06:48:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EC8927F93 for ; Mon, 11 Jun 2018 06:48:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754016AbeFKGs5 (ORCPT ); Mon, 11 Jun 2018 02:48:57 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:40396 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753981AbeFKGsy (ORCPT ); Mon, 11 Jun 2018 02:48:54 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180611064851euoutp01b8ef5be2fc106b626231396c7d8c848d~3CE552vgJ2691026910euoutp01s; Mon, 11 Jun 2018 06:48:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180611064851euoutp01b8ef5be2fc106b626231396c7d8c848d~3CE552vgJ2691026910euoutp01s DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1528699731; bh=BKa8PEqEi190SSRgKJti/d9D7+AIfxLElC+ygh4w6qs=; h=From:To:Cc:Subject:Date:References:From; b=GUwZwVJKR7hXgdxiCOBlqph0z5piLa1dbSGWBiGpJB1BvuWZyKTJqSSkcT+dtAWG0 8IDP7uR/BovgXy1QXSiNwRBtpZcT6C/YpJ71biAorJ6X/NipC/T4AW1KAt+7BdqB4u MuoOhio08fvbX98i5B3UJBdmVJ0tu5xyXMsMtv1s= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180611064849eucas1p25a9b3525ed5088bf5d9a1cb920d039a9~3CE4Pk7hT3148031480eucas1p2Q; Mon, 11 Jun 2018 06:48:49 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 9A.AA.17380.15B1E1B5; Mon, 11 Jun 2018 07:48:49 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180611064849eucas1p134abe313b17ba05cb1e046f3d2f0780f~3CE3kwbXc1273612736eucas1p1N; Mon, 11 Jun 2018 06:48:49 +0000 (GMT) X-AuditID: cbfec7f4-713ff700000043e4-5c-5b1e1b51d97d Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 4E.D1.04183.05B1E1B5; Mon, 11 Jun 2018 07:48:48 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PA500JHFC99WD10@eusync4.samsung.com>; Mon, 11 Jun 2018 07:48:48 +0100 (BST) From: Marek Szyprowski To: linux-mmc@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Jaehoon Chung , Ulf Hansson , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH] mmc: dw_mmc-exynos: fix potential external abort in resume_noirq() Date: Mon, 11 Jun 2018 08:48:38 +0200 Message-id: <20180611064838.11383-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOIsWRmVeSWpSXmKPExsWy7djPc7qB0nLRBm+fKVtsnLGe1eLGrzZW i/PnN7BbHPnfz2gx4/w+Jou1R+6yWxxfG+7A7rFpVSebx51re9g8+rasYvT4vEkugCWKyyYl NSezLLVI3y6BK+PF1A0sBTc4K16dus7WwLiQo4uRk0NCwERiz65l7F2MXBxCAisYJebv+MwI 4XxmlLiz6DCQwwFW1TjZBiK+jFFiweNdUB0NTBL7ry5jAhnFJmAo0fW2iw2kQUTAQeLFeSeQ GmaBB4wSR5+8YgGpERYIlXj/6wWYzSKgKjGhs48NxOYVsJXoe9jOAnGSvMTqDQeYQZolBJ6y ShzY8BMq4SLRuOseI4QtLPHq+BZ2CFtG4vLkbhaIhmZGifYZs9ghnB5Gia1zdrBBVFlLHD5+ kRXEZhbgk5i0bTozxG+8Eh1tQhAlHhJ332wHWyYkECsx80AjywSgbxkZVjGKp5YW56anFhvl pZbrFSfmFpfmpesl5+duYgRG1+l/x7/sYNz1J+kQowAHoxIPr0K6bLQQa2JZcWXuIUYJDmYl EV6P59LRQrwpiZVVqUX58UWlOanFhxilOViUxHnjNOqihATSE0tSs1NTC1KLYLJMHJxSDYwu XwMk6rtFOCStLhdY/9+vHHXwoPLCQwXWlyIiFizTeLVqh+OCNxXLJixd9+NIv0WBpPf7zz8v dsy/O1XvQ87Sg3+0PS4Fu/++7qSVwv/+/awHD37Lfvge/ng+694loj/10pOzs+eJKDkFXTU+ Wckb+Z/7aJriHsNN/srMMUUXpJLnniqae5pJiaU4I9FQi7moOBEAUOOFKaoCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBJMWRmVeSWpSXmKPExsVy+t/xa7oB0nLRBtc+GltsnLGe1eLGrzZW i/PnN7BbHPnfz2gx4/w+Jou1R+6yWxxfG+7A7rFpVSebx51re9g8+rasYvT4vEkugCWKyyYl NSezLLVI3y6BK+PF1A0sBTc4K16dus7WwLiQo4uRg0NCwESicbJNFyMXh5DAEkaJKdsXsUA4 TUwSv37eYO5i5ORgEzCU6HrbxQbSICLgIPHivBNIDbPAA0aJRRsns4LUCAuESrz/9YIFxGYR UJWY0NnHBmLzCthK9D1sB4tLCMhLrN5wgHkCI9cCRoZVjCKppcW56bnFRnrFibnFpXnpesn5 uZsYgf7fduznlh2MXe+CDzEKcDAq8fAqpMtGC7EmlhVX5h5ilOBgVhLh9XguHS3Em5JYWZVa lB9fVJqTWnyIUZqDRUmc97xBZZSQQHpiSWp2ampBahFMlomDU6qBcZYr16vTvXFfeve86bic Ec5x5qFb0oecOsEV7NFT9vNtqxR1WFBhdYkromHbgjUfjT4Z1qbcYzK/YqU1fbn5xNXr+CbP bpc4sMdwrov/yrbvm6vTj52+viBmt3Rj7sOGl8uEKj/pxnrnLsv/G2jIxv37edKNP4F185fd 3RYtkTFFtHtpo8aaZUosxRmJhlrMRcWJACLVMgH7AQAA X-CMS-MailID: 20180611064849eucas1p134abe313b17ba05cb1e046f3d2f0780f X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180611064849eucas1p134abe313b17ba05cb1e046f3d2f0780f References: Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP dw_mci_exynos_resume_noirq() performs DWMMC register access without ensuring that respective clocks are enabled. This might cause external abort on some systems (observed on Exynos5433 based boards). Fix this by adding needed prepare_enable/disable_unprepare calls. Signed-off-by: Marek Szyprowski --- drivers/mmc/host/dw_mmc-exynos.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c index 3164681108ae..6125b68726b0 100644 --- a/drivers/mmc/host/dw_mmc-exynos.c +++ b/drivers/mmc/host/dw_mmc-exynos.c @@ -193,6 +193,9 @@ static int dw_mci_exynos_resume_noirq(struct device *dev) struct dw_mci_exynos_priv_data *priv = host->priv; u32 clksel; + clk_prepare_enable(host->biu_clk); + clk_prepare_enable(host->ciu_clk); + if (priv->ctrl_type == DW_MCI_TYPE_EXYNOS7 || priv->ctrl_type == DW_MCI_TYPE_EXYNOS7_SMU) clksel = mci_readl(host, CLKSEL64); @@ -207,6 +210,9 @@ static int dw_mci_exynos_resume_noirq(struct device *dev) mci_writel(host, CLKSEL, clksel); } + clk_disable_unprepare(host->biu_clk); + clk_disable_unprepare(host->ciu_clk); + return 0; } #else