From patchwork Tue Oct 20 15:06:52 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 54968 Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9KF7hKa002169 for ; Tue, 20 Oct 2009 15:07:43 GMT Received: from dlep36.itg.ti.com ([157.170.170.91]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id n9KF7gGr005679 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 20 Oct 2009 10:07:42 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id n9KF7cAn029431 for ; Tue, 20 Oct 2009 10:07:38 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 4AF2A8063A for ; Tue, 20 Oct 2009 10:07:26 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp51.itg.ti.com (dflp51.itg.ti.com [128.247.22.94]) by linux.omap.com (Postfix) with ESMTP id 8FCB580626 for ; Tue, 20 Oct 2009 10:07:02 -0500 (CDT) Received: from medina.ext.ti.com (localhost [127.0.0.1]) by dflp51.itg.ti.com (8.13.7/8.13.7) with ESMTP id n9KF72P0019723 for ; Tue, 20 Oct 2009 10:07:02 -0500 (CDT) Received: from mail62-va3-R.bigfish.com (mail-va3.bigfish.com [216.32.180.112]) by medina.ext.ti.com (8.13.7/8.13.7) with ESMTP id n9KF71il015289 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Tue, 20 Oct 2009 10:07:02 -0500 Received: from mail62-va3 (localhost.localdomain [127.0.0.1]) by mail62-va3-R.bigfish.com (Postfix) with ESMTP id 4891F585D3 for ; Tue, 20 Oct 2009 15:07:01 +0000 (UTC) X-SpamScore: -24 X-BigFish: vps-24(zz1432R98dN9371Pzz1202hzzz2dh6bh61h) X-Spam-TCS-SCL: 0:0 X-FB-SS: 5, X-MS-Exchange-Organization-Antispam-Report: OrigIP: 209.85.222.188; Service: EHS Received: by mail62-va3 (MessageSwitch) id 1256051218568612_16286; Tue, 20 Oct 2009 15:06:58 +0000 (UCT) Received: from VA3EHSMHS028.bigfish.com (unknown [10.7.14.245]) by mail62-va3.bigfish.com (Postfix) with ESMTP id 87D2F820051 for ; Tue, 20 Oct 2009 15:06:58 +0000 (UTC) Received: from mail-pz0-f188.google.com (209.85.222.188) by VA3EHSMHS028.bigfish.com (10.7.99.38) with Microsoft SMTP Server id 14.0.482.32; Tue, 20 Oct 2009 15:06:54 +0000 Received: by pzk26 with SMTP id 26so4150122pzk.4 for ; Tue, 20 Oct 2009 08:06:54 -0700 (PDT) Received: by 10.114.237.30 with SMTP id k30mr9481853wah.102.1256051214190; Tue, 20 Oct 2009 08:06:54 -0700 (PDT) Received: from localhost ([216.254.16.51]) by mx.google.com with ESMTPS id 20sm957630pzk.9.2009.10.20.08.06.52 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 20 Oct 2009 08:06:53 -0700 (PDT) To: "H Hartley Sweeten" References: <1255720190-7452-9-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-10-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-11-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-12-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-13-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-14-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-15-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-16-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-17-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-18-git-send-email-khilman@deeprootsystems.com> <20091019140752.GC13614@n2100.arm.linux.org.uk> <87my3nq6vl.fsf@deeprootsystems.com> From: Kevin Hilman Organization: Deep Root Systems, LLC Date: Tue, 20 Oct 2009 08:06:52 -0700 In-Reply-To: (H. Hartley Sweeten's message of "Mon\, 19 Oct 2009 20\:15\:39 -0400") Message-ID: <87fx9ep0j7.fsf@deeprootsystems.com> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 X-Reverse-DNS: mail-pz0-f188.google.com Cc: linux-arm-kernel@lists.infradead.org, davinci-linux-open-source@linux.davincidsp.com, Russell King - ARM Linux , "David A. Griego" Subject: Re: [PATCH 16/46] davinci: Add MMC/SD support for DA830/OMAP-L137 EVM X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.4 Precedence: list List-Id: davinci-linux-open-source.linux.davincidsp.com List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c index 39711c1..fe86afa 100644 --- a/arch/arm/mach-davinci/board-da830-evm.c +++ b/arch/arm/mach-davinci/board-da830-evm.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -83,6 +84,57 @@ static struct snd_platform_data da830_evm_snd_data = { .rxnumevt = 1, }; +/* + * GPIO2[1] is used as MMC_SD_WP and GPIO2[2] as MMC_SD_INS. + */ +static const short da830_evm_mmc_sd_pins[] = { + DA830_MMCSD_DAT_0, DA830_MMCSD_DAT_1, DA830_MMCSD_DAT_2, + DA830_MMCSD_DAT_3, DA830_MMCSD_DAT_4, DA830_MMCSD_DAT_5, + DA830_MMCSD_DAT_6, DA830_MMCSD_DAT_7, DA830_MMCSD_CLK, + DA830_MMCSD_CMD, DA830_GPIO2_1, DA830_GPIO2_2, + -1 +}; + +#define DA830_MMCSD_WP_PIN GPIO_TO_PIN(2, 1) + +static int da830_evm_mmc_get_ro(int index) +{ + return gpio_get_value(DA830_MMCSD_WP_PIN); +} + +static struct davinci_mmc_config da830_evm_mmc_config = { + .get_ro = da830_evm_mmc_get_ro, + .wires = 4, + .version = MMC_CTLR_VERSION_2, +}; + +static inline void da830_evm_init_mmc(void) +{ + int ret; + + ret = da8xx_pinmux_setup(da830_evm_mmc_sd_pins); + if (ret) { + pr_warning("da830_evm_init: mmc/sd mux setup failed: %d\n", + ret); + return; + } + + ret = gpio_request(DA830_MMCSD_WP_PIN, "MMC WP"); + if (ret) { + pr_warning("da830_evm_init: can not open GPIO %d\n", + DA830_MMCSD_WP_PIN); + return; + } + gpio_direction_input(DA830_MMCSD_WP_PIN); + + ret = da8xx_register_mmcsd0(&da830_evm_mmc_config); + if (ret) { + pr_warning("da830_evm_init: mmc/sd registration failed: %d\n", + ret); + gpio_free(DA830_MMCSD_WP_PIN); + } +} + static __init void da830_evm_init(void) { struct davinci_soc_info *soc_info = &davinci_soc_info; @@ -132,6 +184,8 @@ static __init void da830_evm_init(void) ret); da8xx_register_mcasp(1, &da830_evm_snd_data); + + da830_evm_init_mmc(); } #ifdef CONFIG_SERIAL_8250_CONSOLE