From patchwork Sat Jul 16 10:46:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 9233151 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 306226075E for ; Sat, 16 Jul 2016 10:46:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2147123861 for ; Sat, 16 Jul 2016 10:46:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1621D25218; Sat, 16 Jul 2016 10:46:17 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 BB1ED23861 for ; Sat, 16 Jul 2016 10:46:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751573AbcGPKqP (ORCPT ); Sat, 16 Jul 2016 06:46:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46781 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751439AbcGPKqO (ORCPT ); Sat, 16 Jul 2016 06:46:14 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5E213C049E16; Sat, 16 Jul 2016 10:46:14 +0000 (UTC) Received: from shalem.localdomain.com (vpn1-4-61.ams2.redhat.com [10.36.4.61]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6GAk5FY019314; Sat, 16 Jul 2016 06:46:12 -0400 From: Hans de Goede To: Ulf Hansson , Maxime Ripard , Chen-Yu Tsai Cc: linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree , Hans de Goede Subject: [PATCH 2/4] mmc: sunxi: Make sample clocks optional Date: Sat, 16 Jul 2016 12:46:02 +0200 Message-Id: <1468665964-27142-3-git-send-email-hdegoede@redhat.com> In-Reply-To: <1468665964-27142-1-git-send-email-hdegoede@redhat.com> References: <1468665964-27142-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 16 Jul 2016 10:46:14 +0000 (UTC) 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 It turns out that sun4i (A10) and sun5i (A13 & co) do not have sample clocks, so make them optional. Since these do not have sample clocks, they cannot (reliably) do DDR rates, so only set MMC_CAP_1_8V_DDR when we do have sample clks. Note this patch only changes the devm_clk_get error checking and sets the clocks to NULL if they don't exists. All the clk_foo calls accept a NULL clk and will return success when called with a NULL clk, so this is all that is necessary. Signed-off-by: Hans de Goede --- drivers/mmc/host/sunxi-mmc.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c index 71a480b..4552ee0 100644 --- a/drivers/mmc/host/sunxi-mmc.c +++ b/drivers/mmc/host/sunxi-mmc.c @@ -1016,14 +1016,20 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host, host->clk_output = devm_clk_get(&pdev->dev, "output"); if (IS_ERR(host->clk_output)) { - dev_err(&pdev->dev, "Could not get output clock\n"); - return PTR_ERR(host->clk_output); + if (PTR_ERR(host->clk_output) != -ENOENT) { + dev_err(&pdev->dev, "Could not get output clock\n"); + return PTR_ERR(host->clk_output); + } + host->clk_output = NULL; } host->clk_sample = devm_clk_get(&pdev->dev, "sample"); if (IS_ERR(host->clk_sample)) { - dev_err(&pdev->dev, "Could not get sample clock\n"); - return PTR_ERR(host->clk_sample); + if (PTR_ERR(host->clk_sample) != -ENOENT) { + dev_err(&pdev->dev, "Could not get sample clock\n"); + return PTR_ERR(host->clk_sample); + } + host->clk_sample = NULL; } host->reset = devm_reset_control_get_optional(&pdev->dev, "ahb"); @@ -1126,9 +1132,11 @@ static int sunxi_mmc_probe(struct platform_device *pdev) mmc->f_min = 400000; mmc->f_max = 52000000; mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | - MMC_CAP_1_8V_DDR | MMC_CAP_ERASE | MMC_CAP_SDIO_IRQ; + if (host->clk_output && host->clk_sample) + mmc->caps |= MMC_CAP_1_8V_DDR; + ret = mmc_of_parse(mmc); if (ret) goto error_free_dma;