From patchwork Thu Aug 5 06:08:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 176332 Return-path: X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on void.printf.net X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.9 tests=RCVD_IN_DNSWL_LOW autolearn=disabled version=3.2.5 Envelope-to: chris@printf.net Delivery-date: Thu, 05 Aug 2010 07:08:42 +0100 Received: from lists.laptop.org ([18.85.2.145] helo=mail.laptop.org) by void.printf.net with esmtp (Exim 4.69) (envelope-from ) id 1OgtdB-0001Pv-Du for chris@printf.net; Thu, 05 Aug 2010 07:08:42 +0100 Received: by mail.laptop.org (Postfix) id D514923A38; Thu, 5 Aug 2010 02:08:23 -0400 (EDT) Delivered-To: cjb@laptop.org Received: from spam.laptop.org (spam.laptop.org [18.85.46.23]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.laptop.org (Postfix) with ESMTPS id BE2D623A34 for ; Thu, 5 Aug 2010 02:08:23 -0400 (EDT) X-ASG-Debug-ID: 1280988517-3563c66f0001-zHW3sV Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by spam.laptop.org with ESMTP id 0uOCarddhRWPBJGN for ; Thu, 05 Aug 2010 02:08:37 -0400 (EDT) X-Barracuda-Envelope-From: linux-mmc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757869Ab0HEGIc (ORCPT ); Thu, 5 Aug 2010 02:08:32 -0400 Received: from mail-gy0-f174.google.com ([209.85.160.174]:57317 "EHLO mail-gy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757624Ab0HEGIc (ORCPT ); Thu, 5 Aug 2010 02:08:32 -0400 Received: by gyg10 with SMTP id 10so2360832gyg.19 for ; Wed, 04 Aug 2010 23:08:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:cc:content-type; bh=KZI8LnIfiiQJrVl/9q9dNfM5A8ZqGBTvSqyogwx0nMU=; b=txCQ4JV0I9fq80Ox//iR0lelzl5BnhQZFFtV93GHMPt97oHMhqiUZWLMkxal8YUZjz IaWvjoR/fd69XgFiyXhA67FWV+UzhXdOm6pxKtUfhi7wwz4vNP7b0V/D0aJFz1eSFZvn 07ZNmQCykviXRqj6yGyQ031YXfqR3T3cVAQpk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type; b=C/1b2EPH5UdGkVM0QMix8rbp2svQ95kavpo4hWZCgM2Z9Wx5rM7D4oV52u6+nrbe/Q SHsBV/WM2iT4Jc8kWdYgHYV3fIYAIpWD0MBpWgTuy659k4X/YjhUAhHo4JAp9kPA8VAh XJcfOsv3xFllZ3B275t8l50a9fGsmxpBp9ddM= MIME-Version: 1.0 Received: by 10.231.147.202 with SMTP id m10mr11939297ibv.2.1280988511346; Wed, 04 Aug 2010 23:08:31 -0700 (PDT) Received: by 10.231.208.16 with HTTP; Wed, 4 Aug 2010 23:08:31 -0700 (PDT) Date: Thu, 5 Aug 2010 14:08:31 +0800 Message-ID: X-ASG-Orig-Subj: [patch 1/1]sdhci: sdhc spec 3.0 add some modification Subject: [patch 1/1]sdhci: sdhc spec 3.0 add some modification From: zhangfei gao To: linux-mmc@vger.kernel.org Cc: Matt Fleming , Anton Vorontsov , Ben Dooks , Wolfram Sang Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Barracuda-Connect: vger.kernel.org[209.132.180.67] X-Barracuda-Start-Time: 1280988517 X-Barracuda-URL: http://18.85.46.23:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at laptop.org X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=5.5 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.37077 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index c6d1bd8..89b323e 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1002,7 +1002,8 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock) } div >>= 1; - clk = div << SDHCI_DIVIDER_SHIFT; + clk = (div & SDHCI_DIV_MASK) << SDHCI_DIVIDER_SHIFT; + clk |= ((div & SDHCI_DIV_HI_MASK) >> SDHCI_DIVIDER_SHIFT) << SDHCI_DIVIDER_SHIFT_HI; clk |= SDHCI_CLOCK_INT_EN; sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); @@ -1159,10 +1160,16 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL); - if (ios->bus_width == MMC_BUS_WIDTH_4) + if (ios->bus_width == MMC_BUS_WIDTH_8) { + ctrl |= SDHCI_CTRL_8BITBUS; + ctrl &= ~SDHCI_CTRL_4BITBUS; + } else if (ios->bus_width == MMC_BUS_WIDTH_4) { ctrl |= SDHCI_CTRL_4BITBUS; - else + ctrl &= ~SDHCI_CTRL_8BITBUS; + } else { ctrl &= ~SDHCI_CTRL_4BITBUS; + ctrl &= ~SDHCI_CTRL_4BITBUS; + } if (ios->timing == MMC_TIMING_SD_HS) ctrl |= SDHCI_CTRL_HISPD; @@ -1681,7 +1688,7 @@ int sdhci_add_host(struct sdhci_host *host) host->version = sdhci_readw(host, SDHCI_HOST_VERSION); host->version = (host->version & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT; - if (host->version > SDHCI_SPEC_200) { + if (host->version > SDHCI_SPEC_300) { printk(KERN_ERR "%s: Unknown controller version (%d). " "You may experience problems.\n", mmc_hostname(mmc), host->version); diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index c846813..2cb14eb 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -72,6 +72,7 @@ #define SDHCI_CTRL_ADMA1 0x08 #define SDHCI_CTRL_ADMA32 0x10 #define SDHCI_CTRL_ADMA64 0x18 +#define SDHCI_CTRL_8BITBUS 0x20 #define SDHCI_POWER_CONTROL 0x29 #define SDHCI_POWER_ON 0x01 @@ -85,6 +86,9 @@ #define SDHCI_CLOCK_CONTROL 0x2C #define SDHCI_DIVIDER_SHIFT 8 +#define SDHCI_DIVIDER_SHIFT_HI 6 +#define SDHCI_DIV_MASK 0xFF +#define SDHCI_DIV_HI_MASK 0x300 #define SDHCI_CLOCK_CARD_EN 0x0004 #define SDHCI_CLOCK_INT_STABLE 0x0002 #define SDHCI_CLOCK_INT_EN 0x0001 @@ -177,6 +181,7 @@ #define SDHCI_SPEC_VER_SHIFT 0 #define SDHCI_SPEC_100 0 #define SDHCI_SPEC_200 1 +#define SDHCI_SPEC_300 2 struct sdhci_ops;