From patchwork Tue Oct 6 01:22:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Wojtas X-Patchwork-Id: 7332871 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E5CB6BEEA4 for ; Tue, 6 Oct 2015 01:18:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 215F02068E for ; Tue, 6 Oct 2015 01:18:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3657A20687 for ; Tue, 6 Oct 2015 01:18:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751616AbbJFBQX (ORCPT ); Mon, 5 Oct 2015 21:16:23 -0400 Received: from mail-la0-f47.google.com ([209.85.215.47]:33389 "EHLO mail-la0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751736AbbJFBQN (ORCPT ); Mon, 5 Oct 2015 21:16:13 -0400 Received: by lafb9 with SMTP id b9so46821524laf.0 for ; Mon, 05 Oct 2015 18:16:12 -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=V5LfZLJ51GrO3j1amPn4/0xLfnRbm0CxQw3gfisER5Q=; b=KGi0+rgcPC83kQxy75PBTQSxh6wR38ACKUK3hH+spuRca2UCwyS2KxHb608HqIV2h0 xBg/oOgTHrv8SbnpRXJ0jxttx0MYF4hgXYF1zCzZ+ZkLiVplrmENdOxJMi4kU/3v4OLK ZAwJUhjExX5LzHd2cmbSw/X8rHMqmsHSskbxv4OzNICninhcPmMLca7Uio10pWWAdKvT dUR/cmA/VwuBrOjTBc3Pydzq69J6eG1cfzGuIB84d2oua5XdFCm/Enfc6EP8E7uP1GUj R0+OColHXFeAcRi+hY/Z0csd9LetFZNjLf4/0q6wE+kjgrB0icDzLOFIdXLBMcVS1gIQ ZG7w== X-Gm-Message-State: ALoCoQlgoGCg4hpTlzEq5LOeRNg/V2MhN42hnAWc4qcuKR/2RNqFM0z+9tZStC7JTzJuqzEIcR0K X-Received: by 10.25.43.9 with SMTP id r9mr8665332lfr.45.1444094171987; Mon, 05 Oct 2015 18:16:11 -0700 (PDT) Received: from enkidu.semihalf.local (cardhu.semihalf.com. [213.17.239.108]) by smtp.gmail.com with ESMTPSA id x1sm4694780lbb.32.2015.10.05.18.16.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Oct 2015 18:16:11 -0700 (PDT) From: Marcin Wojtas To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org Cc: ulf.hansson@linaro.org, sebastian.hesselbarth@gmail.com, andrew@lunn.ch, jason@lakedaemon.net, thomas.petazzoni@free-electrons.com, gregory.clement@free-electrons.com, nadavh@marvell.com, alior@marvell.com, tawfik@marvell.com, mw@semihalf.com, jaz@semihalf.com Subject: [PATCH 8/8] mmc: sdhci-pxav3: enable modifying MMC_CARD bit during card initialization Date: Tue, 6 Oct 2015 03:22:42 +0200 Message-Id: <1444094562-31165-9-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1444094562-31165-1-git-send-email-mw@semihalf.com> References: <1444094562-31165-1-git-send-email-mw@semihalf.com> 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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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. Signed-off-by: Marcin Wojtas --- drivers/mmc/host/sdhci-pxav3.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c index ce96640..315dc4e 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) @@ -221,6 +222,22 @@ static void pxav3_reset(struct sdhci_host *host, u8 mask) } } +static void pxav3_init_card(struct sdhci_host *host, struct mmc_card *card) +{ + struct platform_device *pdev = to_platform_device(mmc_dev(host->mmc)); + struct device_node *np = pdev->dev.of_node; + u32 reg_val; + + if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) { + 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) { @@ -338,6 +355,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 = {