From patchwork Tue Jan 17 15:27:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Herbrechtsmeier Dr.-Ing. , Stefan" X-Patchwork-Id: 716250 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3v2vF91hbtz9sCX for ; Wed, 18 Jan 2017 02:30:37 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3E2EBB389E; Tue, 17 Jan 2017 16:30:16 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QPNJZS5jWdmi; Tue, 17 Jan 2017 16:30:16 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B5002B38EF; Tue, 17 Jan 2017 16:30:10 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C3D32B38B7 for ; Tue, 17 Jan 2017 16:30:06 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0YyE_O84fTOy for ; Tue, 17 Jan 2017 16:30:06 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail2.weidmueller.de (mail2.weidmueller.de [217.244.7.241]) by theia.denx.de (Postfix) with ESMTP id A92C0B38FE for ; Tue, 17 Jan 2017 16:30:05 +0100 (CET) Received: from SRVDE354.weidmueller.com (unknown [10.1.23.126]) by mail2.weidmueller.de with smtp id 52ec_58e0_a7522562_9cb1_4616_be6c_48174765c3bc; Tue, 17 Jan 2017 16:29:55 +0100 Received: from w010094-VirtualBox.weidmueller.com (10.1.94.106) by SRVDE354.weidmueller.com (10.1.23.126) with Microsoft SMTP Server id 14.3.294.0; Tue, 17 Jan 2017 16:29:49 +0100 From: To: Date: Tue, 17 Jan 2017 16:27:33 +0100 Message-ID: <1484666853-19282-11-git-send-email-stefan.herbrechtsmeier@weidmueller.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484666853-19282-1-git-send-email-stefan.herbrechtsmeier@weidmueller.com> References: <1484666853-19282-1-git-send-email-stefan.herbrechtsmeier@weidmueller.com> MIME-Version: 1.0 X-NAIMIME-Disclaimer: 1 X-NAIMIME-Modified: 1 X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 4 X-NAI-Spam-Score: 0 X-NAI-Spam-Version: 2.3.0.9418 : core <5922> : inlines <5632> : streams <1729480> : uri <2359649> Subject: [U-Boot] [PATCH v2 10/10] mmc: zynq: Add fdt max-frequency support X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Stefan Herbrechtsmeier The maximum supported peripheral clock frequency of the zynq depends on the IO routing. The MIO and EMIO support a maximum frequency of 50 MHz respectively 25 MHz. Use the max-frequency value of the device tree to determine the maximal supported peripheral clock frequency. Signed-off-by: Stefan Herbrechtsmeier Acked-by: Michal Simek Reviewed-by: Jaehoon Chung --- Changes in v2: - Add patch to add fdt max-frequency support to zynq mmc driver drivers/mmc/zynq_sdhci.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c index c73a4d3..28cedf0 100644 --- a/drivers/mmc/zynq_sdhci.c +++ b/drivers/mmc/zynq_sdhci.c @@ -14,6 +14,8 @@ #include #include +DECLARE_GLOBAL_DATA_PTR; + #ifndef CONFIG_ZYNQ_SDHCI_MIN_FREQ # define CONFIG_ZYNQ_SDHCI_MIN_FREQ 0 #endif @@ -21,6 +23,7 @@ struct arasan_sdhci_plat { struct mmc_config cfg; struct mmc mmc; + unsigned int f_max; }; static int arasan_sdhci_probe(struct udevice *dev) @@ -60,7 +63,7 @@ static int arasan_sdhci_probe(struct udevice *dev) host->max_clk = clock; - ret = sdhci_setup_cfg(&plat->cfg, host, CONFIG_ZYNQ_SDHCI_MAX_FREQ, + ret = sdhci_setup_cfg(&plat->cfg, host, plat->f_max, CONFIG_ZYNQ_SDHCI_MIN_FREQ); host->mmc = &plat->mmc; if (ret) @@ -74,11 +77,15 @@ static int arasan_sdhci_probe(struct udevice *dev) static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev) { + struct arasan_sdhci_plat *plat = dev_get_platdata(dev); struct sdhci_host *host = dev_get_priv(dev); host->name = dev->name; host->ioaddr = (void *)dev_get_addr(dev); + plat->f_max = fdtdec_get_int(gd->fdt_blob, dev->of_offset, + "max-frequency", CONFIG_ZYNQ_SDHCI_MAX_FREQ); + return 0; }