From patchwork Thu Oct 15 16:25:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Wojtas X-Patchwork-Id: 7408071 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C1C17BEEA4 for ; Thu, 15 Oct 2015 16:20:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F12F8206F2 for ; Thu, 15 Oct 2015 16:20:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1FC2620664 for ; Thu, 15 Oct 2015 16:20:40 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZmlFB-0007Pu-TX; Thu, 15 Oct 2015 16:19:05 +0000 Received: from mail-lb0-f175.google.com ([209.85.217.175]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZmlEP-000676-Ty for linux-arm-kernel@lists.infradead.org; Thu, 15 Oct 2015 16:18:20 +0000 Received: by lbbpp2 with SMTP id pp2so46255380lbb.0 for ; Thu, 15 Oct 2015 09:17:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=K924LoV2/t8ILz1pKBXfHLk1ZaQTfwQQ2yyllIa160Q=; b=Mm/bJ1SAsYYAWnGqCtGUMoMTOG5Uy1O4tkc2j6IXGlqxBatK9sVpkji4nN3M37J10+ dZsEa/96xhW8HMaUKSagCCP8yHlhq2+mfeMiAnPvtiTIfVpY007SjdVnzx9h1pZSzBL5 P0/Ms07yUjIKsCT4nAJiUmvapdyjA+wFfe2vsvL0YuHMnF88SvEDme5SvgM/JPHdv225 XHjWs4yRp5xxZaQWVYh22AHItb+aTjoZJQsSVSwfCIchu06BysqHDyPDBfFLKpcQHD/5 ukCe4nEP9pHF0fF02WwEVV5g4KlBSzAsLC/TsLppghkM1CGKrnu/v3pO71AkQbC7ygZs 2+Mg== X-Gm-Message-State: ALoCoQmi0Ext5fagmdxq7+UCRCO2EPMs5wrWE6QS26COll9W+zTpc6XPh93kfcVyeEjFxi4wAD4a X-Received: by 10.112.150.201 with SMTP id uk9mr5168056lbb.102.1444925875772; Thu, 15 Oct 2015 09:17:55 -0700 (PDT) Received: from enkidu.semihalf.local ([80.82.22.190]) by smtp.gmail.com with ESMTPSA id r137sm2185323lfe.34.2015.10.15.09.17.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2015 09:17:55 -0700 (PDT) From: Marcin Wojtas To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org Subject: [PATCH v3 5/5] mmc: sdhci-pxav3: enable modifying MMC_CARD bit during card initialization Date: Thu, 15 Oct 2015 18:25:46 +0200 Message-Id: <1444926346-29763-6-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1444926346-29763-1-git-send-email-mw@semihalf.com> References: <1444926346-29763-1-git-send-email-mw@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151015_091818_298792_34CB1CF7 X-CRM114-Status: GOOD ( 13.06 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thomas.petazzoni@free-electrons.com, andrew@lunn.ch, ulf.hansson@linaro.org, jason@lakedaemon.net, tawfik@marvell.com, jaz@semihalf.com, nadavh@marvell.com, alior@marvell.com, jszhang@marvell.com, gregory.clement@free-electrons.com, mw@semihalf.com, sebastian.hesselbarth@gmail.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 On Marvell Armada 38x SoC's the MMC_CARD bit in SD_CE_ATA_1 register must be set to 0x1 when a MMC card is supposed to work in DDR mode, or when commands CMD11, CMD14 and CMD20 are used. This commit enables the above for all MMC cards by modifying the host registers during card initialization. It is done by using init_card() callback with pxa->mbus_win_regs as a flag, which notifies if Armada 38x controller is in use. Signed-off-by: Marcin Wojtas --- drivers/mmc/host/sdhci-pxav3.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c index d813233..8742afd 100644 --- a/drivers/mmc/host/sdhci-pxav3.c +++ b/drivers/mmc/host/sdhci-pxav3.c @@ -57,6 +57,7 @@ #define SD_SPI_MODE 0x108 #define SD_CE_ATA_1 0x10C +#define SDCE_MMC_CARD BIT(28) #define SD_CE_ATA_2 0x10E #define SDCE_MISC_INT (1<<2) @@ -230,6 +231,26 @@ static void pxav3_reset(struct sdhci_host *host, u8 mask) } } +static void pxav3_init_card(struct sdhci_host *host, struct mmc_card *card) +{ + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct sdhci_pxa *pxa = pltfm_host->priv; + u32 reg_val; + + /* + * Armada 38x SDHCI controller requires update of + * MMC_CARD bit depending on inserted card type. + */ + if (pxa->mbus_win_regs) { + reg_val = sdhci_readl(host, SD_CE_ATA_1); + if (mmc_card_mmc(card)) + reg_val |= SDCE_MMC_CARD; + else + reg_val &= ~SDCE_MMC_CARD; + sdhci_writel(host, reg_val, SD_CE_ATA_1); + } +} + #define MAX_WAIT_COUNT 5 static void pxav3_gen_init_74_clocks(struct sdhci_host *host, u8 power_mode) { @@ -347,6 +368,7 @@ static const struct sdhci_ops pxav3_sdhci_ops = { .set_bus_width = sdhci_set_bus_width, .reset = pxav3_reset, .set_uhs_signaling = pxav3_set_uhs_signaling, + .init_card = pxav3_init_card, }; static struct sdhci_pltfm_data sdhci_pxav3_pdata = {