From patchwork Fri May 13 05:47:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arindam Nath X-Patchwork-Id: 781732 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4D5m2jg009499 for ; Fri, 13 May 2011 05:48:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756154Ab1EMFsS (ORCPT ); Fri, 13 May 2011 01:48:18 -0400 Received: from mail-pw0-f46.google.com ([209.85.160.46]:45648 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756064Ab1EMFsS (ORCPT ); Fri, 13 May 2011 01:48:18 -0400 Received: by pwi15 with SMTP id 15so1037551pwi.19 for ; Thu, 12 May 2011 22:48:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:cc:subject:date:message-id :x-mailer:in-reply-to:references; bh=q1/n7s63LUqPph8kttV/MQIrAl6VzFQJroZ+1VIjecw=; b=ZYadC1ltmUNBv3JW5jjOr/3dmY5XsM2VDgIG0ItDVR2WUTcJD1ld19vj+RQGqQJDNf mKGUmdDWWvd7YoblJMjl5ufhFvXPnKz+G5dcaqPH7+fzY6nvXno2Ms1gSlJ/1RS6BJyj 9FKSoxXUNt0yE22TUqqUBh9ePrm5Ny+6qBuQ4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; b=MGrnyACnCd2r5Y4jCB7JhdLdr+cNdQIIOkHQwLGSrrVLQ1swpLOuVdbYlCaN6StUIb z/lUVOKtc3Zl+tuxpaiFcb4CeTBQEz71ZfYS0kqfB6cJb7s8CM5rYKxvYgfvHuu7ynUu ZXjSjbVlmFr6nkyTSJPvayt3Mo2kPuru7FwEs= Received: by 10.68.54.170 with SMTP id k10mr1563477pbp.522.1305265697186; Thu, 12 May 2011 22:48:17 -0700 (PDT) Received: from localhost ([122.167.11.185]) by mx.google.com with ESMTPS id 8sm1145295pbw.23.2011.05.12.22.48.10 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 12 May 2011 22:48:16 -0700 (PDT) From: Arindam Nath To: cjb@laptop.org Cc: linux-mmc@vger.kernel.org, prakity@marvell.com, zhangfei.gao@gmail.com, Arindam Nath Subject: [PATCH v2 1/4] sdhci add hooks for UHS setting by platform specific code Date: Fri, 13 May 2011 11:17:15 +0530 Message-Id: <1305265638-1572-2-git-send-email-arindam.nath@amd.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1305265638-1572-1-git-send-email-arindam.nath@amd.com> References: <1305265638-1572-1-git-send-email-arindam.nath@amd.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 13 May 2011 05:48:19 +0000 (UTC) From: Philip Rakity Allow platform specific code to set UHS registers if implementation requires speciial platform specific handling Signed-off-by: Philip Rakity Reviewed-by: Arindam Nath --- drivers/mmc/host/sdhci.c | 33 ++++++++++++++++++--------------- drivers/mmc/host/sdhci.h | 2 ++ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index fa33016..cc63f5e 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1346,27 +1346,30 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) sdhci_set_clock(host, clock); } - ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2); - - /* Select Bus Speed Mode for host */ - ctrl_2 &= ~SDHCI_CTRL_UHS_MASK; - if (ios->timing == MMC_TIMING_UHS_SDR12) - ctrl_2 |= SDHCI_CTRL_UHS_SDR12; - else if (ios->timing == MMC_TIMING_UHS_SDR25) - ctrl_2 |= SDHCI_CTRL_UHS_SDR25; - else if (ios->timing == MMC_TIMING_UHS_SDR50) - ctrl_2 |= SDHCI_CTRL_UHS_SDR50; - else if (ios->timing == MMC_TIMING_UHS_SDR104) - ctrl_2 |= SDHCI_CTRL_UHS_SDR104; - else if (ios->timing == MMC_TIMING_UHS_DDR50) - ctrl_2 |= SDHCI_CTRL_UHS_DDR50; /* Reset SD Clock Enable */ clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL); clk &= ~SDHCI_CLOCK_CARD_EN; sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); - sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2); + if (host->ops->set_uhs_signaling) + host->ops->set_uhs_signaling(host, ios->timing); + else { + ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2); + /* Select Bus Speed Mode for host */ + ctrl_2 &= ~SDHCI_CTRL_UHS_MASK; + if (ios->timing == MMC_TIMING_UHS_SDR12) + ctrl_2 |= SDHCI_CTRL_UHS_SDR12; + else if (ios->timing == MMC_TIMING_UHS_SDR25) + ctrl_2 |= SDHCI_CTRL_UHS_SDR25; + else if (ios->timing == MMC_TIMING_UHS_SDR50) + ctrl_2 |= SDHCI_CTRL_UHS_SDR50; + else if (ios->timing == MMC_TIMING_UHS_SDR104) + ctrl_2 |= SDHCI_CTRL_UHS_SDR104; + else if (ios->timing == MMC_TIMING_UHS_DDR50) + ctrl_2 |= SDHCI_CTRL_UHS_DDR50; + sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2); + } /* Re-enable SD Clock */ clock = host->clock; diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 8ea11b7..7e28eec 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -270,6 +270,8 @@ struct sdhci_ops { unsigned int (*get_ro)(struct sdhci_host *host); void (*platform_reset_enter)(struct sdhci_host *host, u8 mask); void (*platform_reset_exit)(struct sdhci_host *host, u8 mask); + int (*set_uhs_signaling)(struct sdhci_host *host, unsigned int uhs); + }; #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS