From patchwork Tue Jun 23 21:38:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 487820 X-Patchwork-Delegate: sjg@chromium.org 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 3E31C14012C for ; Wed, 24 Jun 2015 07:49:34 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=dJS+ZkoR; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8B91C4B6A8; Tue, 23 Jun 2015 23:49:31 +0200 (CEST) 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 mNXTorpO1VQQ; Tue, 23 Jun 2015 23:49:31 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 513FB4B705; Tue, 23 Jun 2015 23:49:12 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BEE434B6A7 for ; Tue, 23 Jun 2015 23:48:54 +0200 (CEST) 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 dhhT-svWH25p for ; Tue, 23 Jun 2015 23:48:54 +0200 (CEST) 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 mail-ig0-f181.google.com (mail-ig0-f181.google.com [209.85.213.181]) by theia.denx.de (Postfix) with ESMTPS id 4B2104B667 for ; Tue, 23 Jun 2015 23:48:51 +0200 (CEST) Received: by igboe5 with SMTP id oe5so99993761igb.1 for ; Tue, 23 Jun 2015 14:48:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=nQ4/B18r6ubYHoSFlq8D1/B8zUkly78GQ++F9CmyVoo=; b=dJS+ZkoRNTxa7LYOck9nmAFZGkXHwNAU0oq0PHQLj9p5qrHWKaBne5lGKKXT8PGrMf 3/IcNOwW5PkIi978oFdB5yDuwjdoG2oe1UXwCzv5mhx4XtrUfGpYwd21kE/pDCq7i++U 3rWMrxp+BcKAC5iJY0jbcPIZSwldCNahZVnIq5Rk7Ker6K+hCh/P/vIrlE2TpBx3A10B bHYvuD2+JilfO0ICHak5wgFIiUcwsTtY932VrzE8c6e5aOOYW/nHJB0znWXfRMUXuh54 MNaYrlmzEN2HIoVRS3iZ/TBJYQS89CQr0P5N0a7gmBJI+AAxpcoqHpRl1JCRfBnYznBi Yz7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=nQ4/B18r6ubYHoSFlq8D1/B8zUkly78GQ++F9CmyVoo=; b=I8Jc+4UQjNTTS72r0ow5qE91/dz7OvFIjwo9Sn9w0eSJHL/3Bqck7i7Tu8LnV91wFV rZ6VnkhHDgeXq3BZg6ScAKHHaS66iDF3Li7rj9sjacvtcodXig85O87d5sH1miOw+068 tiJM9yv9ygwkgTTK3j331i6xeunxA2if7lC5s26X7vcv+M00+633eTs3EYNs/5lX6Wri ALolrXCIrcAoi4TIvlPX3Q9qw9D/+40WrNSm9hbhhoqGQ0Y78e+dWCkeNG8r9HqOZTB5 QsPu+FUpEfZ+5pG5kAmU0O0UWKlcrB7+BrrC5FiWNSo/fHibBZG1vYdiVosavhnvD1Gi K8KQ== X-Gm-Message-State: ALoCoQnNQJFBk3/1psXR/OXBIwTHT+azHyoSGUDZ1ziVnPlCidIxTgHZ9SA72tYwa7fAy99DLlMB X-Received: by 10.50.143.38 with SMTP id sb6mr4989581igb.44.1435096130164; Tue, 23 Jun 2015 14:48:50 -0700 (PDT) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by mx.google.com with ESMTPSA id h138sm15918783ioe.2.2015.06.23.14.48.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jun 2015 14:48:48 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id EB7252220A0; Tue, 23 Jun 2015 15:39:51 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 23 Jun 2015 15:38:53 -0600 Message-Id: <1435095556-15924-32-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.4.3.573.g4eafbef In-Reply-To: <1435095556-15924-1-git-send-email-sjg@chromium.org> References: <1435095556-15924-1-git-send-email-sjg@chromium.org> Cc: Tom Rini , Pantelis Antoniou , Przemyslaw Marczak Subject: [U-Boot] [PATCH v3 31/54] mmc: Support bypass mode with the get_mmc_clk() method 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Some SoCs want to adjust the input clock to the DWMMC block as a way of controlling the MMC bus clock. Update the get_mmc_clk() method to support this. Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None drivers/mmc/dw_mmc.c | 2 +- drivers/mmc/exynos_dw_mmc.c | 2 +- include/dwmmc.h | 16 +++++++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index 8f28d7e..a034c3f 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -248,7 +248,7 @@ static int dwmci_setup_bus(struct dwmci_host *host, u32 freq) * host->bus_hz should be set by user. */ if (host->get_mmc_clk) - sclk = host->get_mmc_clk(host); + sclk = host->get_mmc_clk(host, freq); else if (host->bus_hz) sclk = host->bus_hz; else { diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index e083745..3f702ba 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -39,7 +39,7 @@ static void exynos_dwmci_clksel(struct dwmci_host *host) dwmci_writel(host, DWMCI_CLKSEL, priv->sdr_timing); } -unsigned int exynos_dwmci_get_clk(struct dwmci_host *host) +unsigned int exynos_dwmci_get_clk(struct dwmci_host *host, uint freq) { unsigned long sclk; int8_t clk_div; diff --git a/include/dwmmc.h b/include/dwmmc.h index 7a7555a..25cf42c 100644 --- a/include/dwmmc.h +++ b/include/dwmmc.h @@ -163,7 +163,21 @@ struct dwmci_host { void (*clksel)(struct dwmci_host *host); void (*board_init)(struct dwmci_host *host); - unsigned int (*get_mmc_clk)(struct dwmci_host *host); + + /** + * Get / set a particular MMC clock frequency + * + * This is used to request the current clock frequency of the clock + * that drives the DWMMC peripheral. The caller will then use this + * information to work out the divider it needs to achieve the + * required MMC bus clock frequency. If you want to handle the + * clock external to DWMMC, use @freq to select the frequency and + * return that value too. Then DWMMC will put itself in bypass mode. + * + * @host: DWMMC host + * @freq: Frequency the host is trying to achieve + */ + unsigned int (*get_mmc_clk)(struct dwmci_host *host, uint freq); struct mmc_config cfg; };