From patchwork Tue Apr 17 12:09:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Stuebner X-Patchwork-Id: 10344875 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 D0F8060216 for ; Tue, 17 Apr 2018 12:09:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C348528A3E for ; Tue, 17 Apr 2018 12:09:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3D7928A64; Tue, 17 Apr 2018 12:09:53 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 19EC928A2E for ; Tue, 17 Apr 2018 12:09:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=Q0mL2K6pw4qJ0R2P1F/hSO2eUhEg6LP6VW8UJFpJ3r4=; b=YZG 14j049/D9W/5YGztVMGJ+53t0UZ8byRG/k/X1LOWLLdcX0xtYpxgjxzQKjOTjB9vOufIUwnUWgLXr DGv806zD4csSPvT3izmGE9eRF4rys5+0oADMEIVVl+HArFX+azy38imfDuE6bihOLuzqwoAiNppwH svL8Zxn91PZ44PVtX1Q9w/gKd6CdLOPHFvp2pyuq25kDBTF3YEZOhJ5XLhFjVgRqeIhmi5hCwKk23 DYSgCGXOJ8fNkoWhQijlIfxFO8cqGBLrPjeXM+dBFo8vE4IdjYkhDfTAje6NLQoxfIPvU+w9fRups weHINoHvp2Nq199oIDI+PWJTFPNEv5Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f8PQl-0002GP-K9; Tue, 17 Apr 2018 12:09:51 +0000 Received: from gloria.sntech.de ([95.129.55.99]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f8PQi-0002FY-9X for linux-rockchip@lists.infradead.org; Tue, 17 Apr 2018 12:09:50 +0000 Received: from wd0542.dip.tu-dresden.de ([141.76.110.30] helo=phil.dip.tu-dresden.de) by gloria.sntech.de with esmtpsa (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1f8PQT-0003P9-0B; Tue, 17 Apr 2018 14:09:33 +0200 From: Heiko Stuebner To: joro@8bytes.org Subject: [PATCH v2] iommu/rockchip: make clock handling optional Date: Tue, 17 Apr 2018 14:09:15 +0200 Message-Id: <20180417120915.31535-1-heiko@sntech.de> X-Mailer: git-send-email 2.16.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180417_050948_813405_153E5EB7 X-CRM114-Status: GOOD ( 14.10 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , jeffy.chen@rock-chips.com, vicencb@gmail.com, tfiga@chromium.org, linux-rockchip@lists.infradead.org, iommu@lists.linux-foundation.org, enric.balletbo@collabora.com, robin.murphy@arm.com, tomeu@tomeuvizoso.net MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP iommu clocks are optional, so the driver should not fail if they are not present. Instead just set the number of clocks to 0, which the clk-blk APIs can handle just fine. Fixes: f2e3a5f557ad ("iommu/rockchip: Control clocks needed to access the IOMMU") Signed-off-by: Heiko Stuebner Reviewed-by: Robin Murphy Tested-by: Enric Balletbo i Serra --- changes in v2: - keep it required in the binding for future variants but optional in the code for backwards compatiblity - follow Robin Murphy's beautification suggestion As the original changes breaks a lot of display support in 4.17-rc1, this should abviously go in as fix into 4.17. drivers/iommu/rockchip-iommu.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index 5fc8656c60f9..422d22990289 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -1175,8 +1175,15 @@ static int rk_iommu_probe(struct platform_device *pdev) for (i = 0; i < iommu->num_clocks; ++i) iommu->clocks[i].id = rk_iommu_clocks[i]; + /* + * iommu clocks should be present for all new devices and devicetrees + * but there are older devicetrees without clocks out in the wild. + * So clocks as optional for the time being. + */ err = devm_clk_bulk_get(iommu->dev, iommu->num_clocks, iommu->clocks); - if (err) + if (err == -ENOENT) + iommu->num_clocks = 0; + else if (err) return err; err = clk_bulk_prepare(iommu->num_clocks, iommu->clocks);