From patchwork Tue Jul 22 05:35:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 4599781 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B0004C0514 for ; Tue, 22 Jul 2014 05:35:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E22FF20120 for ; Tue, 22 Jul 2014 05:35:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 014C320125 for ; Tue, 22 Jul 2014 05:35:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751727AbaGVFfS (ORCPT ); Tue, 22 Jul 2014 01:35:18 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:35283 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751164AbaGVFfR (ORCPT ); Tue, 22 Jul 2014 01:35:17 -0400 Received: by mail-pa0-f53.google.com with SMTP id kq14so11294595pab.12 for ; Mon, 21 Jul 2014 22:35:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:sender:message-id:to:cc:in-reply-to:references:from:subject :user-agent:mime-version:content-type; bh=gfM7hPWwLW+cz+ac8bLc9LFDVaA+upj/7ShbBKtDnhw=; b=vth2MfZtM8rO9z3CsquOx6HFOd7pMTCgIvwzKaGqry58Y1wnZP0irC1W9D2FP+AFX+ 0dUIxFP83thSQfcD8UwAGNosuBLvHDX+pDO/rlSlZAQYWYavxnf4OVL6Yj6RPW9/v5Se 1RWoyuy3dnu80ALyseWcNQw+AQjjgdi5yhNEWi8wrnV3cWgaT6QQjamTTpyVKqrxUGb0 Z9jmW08N/YeHG5Pc9vNm9Zij394l8u5R+3X7AcfKb1FC7rNbFLUCrhfSqo/Z/5Vbm1ox MUKfjk4mfrZ/1g7b0F59WlP4tO9naP/u2v/9f5Fox+eXSDuxteKpkQFEFqQU37u50J47 EmSA== X-Received: by 10.68.177.130 with SMTP id cq2mr14489250pbc.119.1406007317088; Mon, 21 Jul 2014 22:35:17 -0700 (PDT) Received: from remon.gmail.com (49.14.32.202.bf.2iij.net. [202.32.14.49]) by mx.google.com with ESMTPSA id g6sm65539108pat.2.2014.07.21.22.35.15 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 21 Jul 2014 22:35:16 -0700 (PDT) Date: Mon, 21 Jul 2014 22:35:16 -0700 (PDT) Message-ID: <87zjg2gdm5.wl%kuninori.morimoto.gx@renesas.com> To: Simon , Ian Molton , Chris Ball Cc: TOSHIAKI KOMATSU , NAOYA SHIIBA , Magnus , Linux-SH , (Renesas) goda , linux-mmc@vger.kernel.org, ryo.kataoka.wt@renesas.com, shinobu.uehara.xc@renesas.com, kouei.abe.cp@renesas.com In-Reply-To: <87egxehsec.wl%kuninori.morimoto.gx@gmail.com> References: <87simtenpi.wl%kuninori.morimoto.gx@renesas.com> <87pphxe2q0.wl%kuninori.morimoto.gx@renesas.com> <53AD638C.5060907@renesas.com> <87egxehsec.wl%kuninori.morimoto.gx@gmail.com> From: Kuninori Morimoto Subject: [PATCH 10/10] mmc: tmio: add actual clock support as option User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Shinobu Uehara Some controller is supporting actual clock on SD_CLK_CTRL :: DIV[7:0]. Renesas SH-Mobile SDHI doesn't support, but, Renesas R-Car SDHI supports it. This patch adds new TMIO_MMC_CLK_ACTUAL flag for it. [Kuninori Morimoto: tidyuped for upstreaming] Signed-off-by: Shinobu Uehara Signed-off-by: Kuninori Morimoto --- drivers/mmc/host/sh_mobile_sdhi.c | 6 ++++-- drivers/mmc/host/tmio_mmc_pio.c | 5 +++++ include/linux/mfd/tmio.h | 5 +++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c index b16f1bb..73fac95 100644 --- a/drivers/mmc/host/sh_mobile_sdhi.c +++ b/drivers/mmc/host/sh_mobile_sdhi.c @@ -49,12 +49,14 @@ static const struct sh_mobile_sdhi_of_data sh_mobile_sdhi_of_cfg[] = { }; static const struct sh_mobile_sdhi_of_data of_rcar_gen1_compatible = { - .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE, + .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE | + TMIO_MMC_CLK_ACTUAL, .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ, }; static const struct sh_mobile_sdhi_of_data of_rcar_gen2_compatible = { - .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE, + .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE | + TMIO_MMC_CLK_ACTUAL, .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ, .capabilities2 = MMC_CAP2_NO_2BLKS_READ, .dma_rx_offset = 0x2000, diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c index da3c74d..f268ba6 100644 --- a/drivers/mmc/host/tmio_mmc_pio.c +++ b/drivers/mmc/host/tmio_mmc_pio.c @@ -150,6 +150,11 @@ static void tmio_mmc_set_clock(struct tmio_mmc_host *host, int new_clock) for (clock = host->mmc->f_min, clk = 0x80000080; new_clock >= (clock<<1); clk >>= 1) clock <<= 1; + + /* 1/1 clock is option */ + if ((host->pdata->flags & TMIO_MMC_CLK_ACTUAL) && + ((clk >> 22) & 0x1)) + clk |= 0xff; } if (host->set_clk_div) diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h index adcb0cd..90436d5 100644 --- a/include/linux/mfd/tmio.h +++ b/include/linux/mfd/tmio.h @@ -99,6 +99,11 @@ */ #define TMIO_MMC_HAVE_CTL_DMA_REG (1 << 9) +/* + * Some controllers allows to set SDx actual clock + */ +#define TMIO_MMC_CLK_ACTUAL (1 << 10) + int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);