From patchwork Wed Jul 10 19:21:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2825870 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2FD7F9F756 for ; Wed, 10 Jul 2013 19:21:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 37EEF20161 for ; Wed, 10 Jul 2013 19:21:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 48F6820160 for ; Wed, 10 Jul 2013 19:21:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755093Ab3GJTV3 (ORCPT ); Wed, 10 Jul 2013 15:21:29 -0400 Received: from moutng.kundenserver.de ([212.227.17.10]:49409 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755108Ab3GJTV1 (ORCPT ); Wed, 10 Jul 2013 15:21:27 -0400 Received: from axis700.grange (dslb-178-001-141-087.pools.arcor-ip.net [178.1.141.87]) by mrelayeu.kundenserver.de (node=mreu0) with ESMTP (Nemesis) id 0MPKo0-1Usa6g1FWS-004mU8; Wed, 10 Jul 2013 21:21:18 +0200 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id C86B140BB4; Wed, 10 Jul 2013 21:21:17 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1Uwzwz-0002jG-Hx; Wed, 10 Jul 2013 21:21:17 +0200 From: Guennadi Liakhovetski To: linux-mmc@vger.kernel.org Cc: linux-sh@vger.kernel.org, Magnus Damm , Simon Horman , Chris Ball , Nobuyuki HIRAI , Guennadi Liakhovetski Subject: [PATCH 2/6] mmc: sh_mmcif: revision-specific CLK_CTRL2 handling Date: Wed, 10 Jul 2013 21:21:13 +0200 Message-Id: <1373484077-10460-3-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1373484077-10460-1-git-send-email-g.liakhovetski@gmx.de> References: <1373484077-10460-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:d3P3RfP/Lhe1Oc8YAisoK8r66SEH6hXnCVtV4gVdV/i 7mohqqs8IcgKr0kVOAxQ8cUMAIt164sb/mbnzMi3evl7qlChOk vzhbZThgR4TsiLNH7C2mkgGztvRgKQ62pPXwGjFde+9a81AhAX tMC/4q6wHrb2bwiGv9VXMFlmx3X4dCmCJjBHl7TYSmChxucIwA DuS+jAnS7FEbZXsB+lO17J1VmzaW9IdJyp57fOCIkVvaiLxP2m EkujwoyagqHHlDpS1KNkPaK+q+adBYyLldw8xxJyQGvKluhbpE CWI/d+FZLCF6IyWUHyhzI8jvq+4rasihzNqw7F/jB+pKRzQ/Ly emKIJNvgRE0Wpg9ePjVTJvr+J7UDhfWRYESsR3J2a+axoPpco/ 5EjrnyK93J5Cg== Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 Some newer MMCIF IP revisions contain a CE_CLK_CTRL2 register, that has to be set for proper operation. Support for this feature is added in a way to preserve the current behaviour by default, i.e. when it is not enabled in platform data. Patch is based on work by Nobuyuki HIRAI. Signed-off-by: Guennadi Liakhovetski --- drivers/mmc/host/sh_mmcif.c | 4 ++++ include/linux/mmc/sh_mmcif.h | 2 ++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index 7be20c9..dc3ce52 100644 --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c @@ -246,6 +246,7 @@ struct sh_mmcif_host { bool power; bool card_present; bool ccs_enable; /* Command Completion Signal support */ + bool clk_ctrl2_enable; struct mutex thread_lock; /* DMA support */ @@ -490,6 +491,8 @@ static void sh_mmcif_sync_reset(struct sh_mmcif_host *host) sh_mmcif_writel(host->addr, MMCIF_CE_VERSION, SOFT_RST_OFF); if (host->ccs_enable) tmp |= SCCSTO_29; + if (host->clk_ctrl2_enable) + sh_mmcif_writel(host->addr, MMCIF_CE_CLK_CTRL2, 0x0F0F0000); sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, tmp | SRSPTO_256 | SRBSYTO_29 | SRWDTO_29); /* byte swap on */ @@ -1390,6 +1393,7 @@ static int sh_mmcif_probe(struct platform_device *pdev) host->addr = reg; host->timeout = msecs_to_jiffies(1000); host->ccs_enable = !pd || !pd->ccs_unsupported; + host->clk_ctrl2_enable = pd && pd->clk_ctrl2_present; host->pd = pdev; diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h index b2a22b6..d4277d9 100644 --- a/include/linux/mmc/sh_mmcif.h +++ b/include/linux/mmc/sh_mmcif.h @@ -40,6 +40,7 @@ struct sh_mmcif_plat_data { unsigned int slave_id_rx; bool use_cd_gpio : 1; bool ccs_unsupported : 1; + bool clk_ctrl2_present : 1; unsigned int cd_gpio; u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */ unsigned long caps; @@ -63,6 +64,7 @@ struct sh_mmcif_plat_data { #define MMCIF_CE_INT_MASK 0x00000044 #define MMCIF_CE_HOST_STS1 0x00000048 #define MMCIF_CE_HOST_STS2 0x0000004C +#define MMCIF_CE_CLK_CTRL2 0x00000070 #define MMCIF_CE_VERSION 0x0000007C /* CE_BUF_ACC */