Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp484033pxj; Thu, 3 Jun 2021 11:25:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZZrrcSxILMHuJyQStKgYmjWRWTJuzbAJZzEmV2djxnmeLPUt+ZRHKvgvjY8E+qe132S3y X-Received: by 2002:aa7:d610:: with SMTP id c16mr760907edr.207.1622744718795; Thu, 03 Jun 2021 11:25:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622744718; cv=none; d=google.com; s=arc-20160816; b=z/2amMk7dqdvtcn0urhFTufxUlWAkG85S93XmeQCsfae3eQsLN507+OGNlZgwwHYTG HI05PTcKat0i9drWwQJ5WFXVKkRg92hXdTrkPNDNPOAQhReCOgWZ6cGJPyLRur1FMWPb +9sqVGY4UZlj5YbgdwArrUroSE26xECmG7hagziv1SRM1cRhpUe+7h5/Ak2IZ5mfMcGh aMlf+ONURkop7zdPKfU5NWEKg4c4L4784XNAJPJgu/vRE05/Eu0+Hg+0hIG8DLTVnyko lY7eiwek9qXV1loYbGw+Vz26pJoD4bCBhTnGP4p1TOsI59zA2QoXs2pLResJhKhMBdUk DZgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=a2xeTAddCISEjbnrxVohb8lhlWI3S7gFF0PHXK6yVK0=; b=Fy4VrPti1PFnZZhRIZzIEii24bT7tSMg8iqkr51BPrPpsxzYj8Ybiuut3GBtr0rqHn VDuzPuEnDxc0go2bk26P7zT9Te/1ZcoyZrGCvXdEfnDrbVydKOIbaEel1+TeiU+eg/3y IUWsguYa9LRzndbTeYsILAcIo/FWpLZz5c5BuJOTZJPNVx4fmLVG/r30MXPTscy1/twD p6KU6Q91NBC9Lfojsv0V2AyVvqx+1EUx8QNKZZLSAQfJXKJxnboW6c0+MDOe9g2pVYSw ufqVqgQMGDt1RrHxfikrF2w5slZNmWQaCQq/FFnqZDOxgUdHuNyN7Zr6ODh924bigdb/ qtNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k22si2733023ejd.339.2021.06.03.11.24.39; Thu, 03 Jun 2021 11:25:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229916AbhFCSYl (ORCPT + 99 others); Thu, 3 Jun 2021 14:24:41 -0400 Received: from mga02.intel.com ([134.134.136.20]:6082 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229620AbhFCSYl (ORCPT ); Thu, 3 Jun 2021 14:24:41 -0400 IronPort-SDR: CzCQIv9oEukAEsKzjsMUafIgRPRN8BQNU9w13gTnEP9KNA2vdKqsW2aHz0nmLEjTF9Xf02Qi0p O8xzcygyScUw== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="191222686" X-IronPort-AV: E=Sophos;i="5.83,246,1616482800"; d="scan'208";a="191222686" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2021 11:22:54 -0700 IronPort-SDR: cYBAxOZcDF9xlY6icljnyITeKlTh5nZ6LDxGSPBDxMzt+DDQ6GzKjE57deaB00G9OORiewQLvy CTq2bW/3vf5Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,246,1616482800"; d="scan'208";a="636326865" Received: from coresw01.iind.intel.com ([10.223.252.64]) by fmsmga005.fm.intel.com with ESMTP; 03 Jun 2021 11:22:47 -0700 From: rashmi.a@intel.com To: linux-drivers-review-request@eclists.intel.com, michal.simek@xilinx.com, ulf.hansson@linaro.org, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kishon@ti.com, vkoul@kernel.org, andriy.shevchenko@linux.intel.com, linux-phy@lists.infradead.org Cc: mgross@linux.intel.com, kris.pan@linux.intel.com, furong.zhou@intel.com, mallikarjunappa.sangannavar@intel.com, adrian.hunter@intel.com, mahesh.r.vaidya@intel.com, nandhini.srikandan@intel.com, lakshmi.bai.raja.subramanian@intel.com, rashmi.a@intel.com Subject: =?utf-8?q?=5B=E2=80=9CPATCH=E2=80=9D=201/2=5D=20mmc=3A=20sdhci-of-arasan=3A=20Use=20clock-frequency=20property=20to=20update=20clk=5Fxin?= Date: Thu, 3 Jun 2021 23:52:41 +0530 Message-Id: <20210603182242.25733-2-rashmi.a@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210603182242.25733-1-rashmi.a@intel.com> References: <20210603182242.25733-1-rashmi.a@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rashmi A If clock-frequency property is set and it is not the same as the current clock rate of clk_xin(base clock frequency), set clk_xin to use the provided clock rate. Signed-off-by: Rashmi A Reviewed-by: Adrian Hunter --- drivers/mmc/host/sdhci-of-arasan.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c index 839965f7c717..0e7c07ed9690 100644 --- a/drivers/mmc/host/sdhci-of-arasan.c +++ b/drivers/mmc/host/sdhci-of-arasan.c @@ -1542,6 +1542,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev) } } + sdhci_get_of_property(pdev); + sdhci_arasan->clk_ahb = devm_clk_get(dev, "clk_ahb"); if (IS_ERR(sdhci_arasan->clk_ahb)) { ret = dev_err_probe(dev, PTR_ERR(sdhci_arasan->clk_ahb), @@ -1561,14 +1563,22 @@ static int sdhci_arasan_probe(struct platform_device *pdev) goto err_pltfm_free; } + /* If clock-frequency property is set, use the provided value */ + if (pltfm_host->clock && + pltfm_host->clock != clk_get_rate(clk_xin)) { + ret = clk_set_rate(clk_xin, pltfm_host->clock); + if (ret) { + dev_err(&pdev->dev, "Failed to set SD clock rate\n"); + goto clk_dis_ahb; + } + } + ret = clk_prepare_enable(clk_xin); if (ret) { dev_err(dev, "Unable to enable SD clock.\n"); goto clk_dis_ahb; } - sdhci_get_of_property(pdev); - if (of_property_read_bool(np, "xlnx,fails-without-test-cd")) sdhci_arasan->quirks |= SDHCI_ARASAN_QUIRK_FORCE_CDTEST; -- 2.17.1