From patchwork Wed Sep 16 01:10:20 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mark A. Greer" X-Patchwork-Id: 47793 Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8G1CESt026832 for ; Wed, 16 Sep 2009 01:12:14 GMT Received: from dlep33.itg.ti.com ([157.170.170.112]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id n8G1ATV9030811; Tue, 15 Sep 2009 20:10:29 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep33.itg.ti.com (8.13.7/8.13.7) with ESMTP id n8G1AS5V006251; Tue, 15 Sep 2009 20:10:28 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 8E1FF80627; Tue, 15 Sep 2009 20:10:27 -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 5845880626 for ; Tue, 15 Sep 2009 20:10:26 -0500 (CDT) Received: from red.ext.ti.com (localhost [127.0.0.1]) by dflp51.itg.ti.com (8.13.7/8.13.7) with ESMTP id n8G1APfR003309 for ; Tue, 15 Sep 2009 20:10:25 -0500 (CDT) Received: from mail36-va3-R.bigfish.com (mail-va3.bigfish.com [216.32.180.111]) by red.ext.ti.com (8.13.7/8.13.7) with ESMTP id n8G1AP0o005663 for ; Tue, 15 Sep 2009 20:10:25 -0500 Received: from mail36-va3 (localhost.localdomain [127.0.0.1]) by mail36-va3-R.bigfish.com (Postfix) with ESMTP id 9C3C9C202BF for ; Wed, 16 Sep 2009 01:10:25 +0000 (UTC) X-SpamScore: 7 X-BigFish: vps7(zza4b1ozz1202hzzz2dh6bh62h) X-Spam-TCS-SCL: 1:0 X-FB-SS: 5, X-MS-Exchange-Organization-Antispam-Report: OrigIP: 63.81.120.158; Service: EHS Received: by mail36-va3 (MessageSwitch) id 125306342339638_15423; Wed, 16 Sep 2009 01:10:23 +0000 (UCT) Received: from gateway-1237.mvista.com (gateway-1237.mvista.com [63.81.120.158]) by mail36-va3.bigfish.com (Postfix) with ESMTP id D321612C805D for ; Wed, 16 Sep 2009 01:10:22 +0000 (UTC) Received: from mag.az.mvista.com (mag.az.mvista.com [10.50.1.99]) by hermes.mvista.com (Postfix) with ESMTP id 723631B753; Tue, 15 Sep 2009 18:10:21 -0700 (PDT) Received: from mgreer by mag.az.mvista.com with local (Exim 4.69) (envelope-from ) id 1Mnj2K-0008Nk-AO; Tue, 15 Sep 2009 18:10:20 -0700 Date: Tue, 15 Sep 2009 18:10:20 -0700 From: "Mark A. Greer" To: Davinci List Message-ID: <20090916011020.GA32194@mag.az.mvista.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.17+20080114 (2008-01-14) Cc: "David A. Griego" Subject: [PATCH 1/4] 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@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com From: David A. Griego Add pinmux settings, etc. to enable the MMC/SC hardware. Signed-off-by: David A. Griego Signed-off-by: Mark A. Greer --- arch/arm/mach-davinci/board-da830-evm.c | 43 +++++++++++++++++++++++++++++++ 1 files changed, 43 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c index 39711c1..69a791a 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,38 @@ 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 +}; + +static int da830_evm_mmc_get_ro(int index) +{ + int val, status, gpio_num = 33; + + status = gpio_request(gpio_num, "MMC WP\n"); + if (status < 0) { + pr_warning("%s can not open GPIO %d\n", __func__, gpio_num); + return 0; + } + gpio_direction_input(gpio_num); + val = gpio_get_value(gpio_num); + gpio_free(gpio_num); + return val; +} + +static struct davinci_mmc_config da830_evm_mmc_config = { + .get_ro = da830_evm_mmc_get_ro, + .wires = 4, + .version = MMC_CTLR_VERSION_2, +}; + static __init void da830_evm_init(void) { struct davinci_soc_info *soc_info = &davinci_soc_info; @@ -132,6 +165,16 @@ static __init void da830_evm_init(void) ret); da8xx_register_mcasp(1, &da830_evm_snd_data); + + ret = da8xx_pinmux_setup(da830_evm_mmc_sd_pins); + if (ret) + pr_warning("da830_evm_init: mmc/sd mux setup failed: %d\n", + ret); + + ret = da8xx_register_mmcsd0(&da830_evm_mmc_config); + if (ret) + pr_warning("da830_evm_init: mmc/sd registration failed: %d\n", + ret); } #ifdef CONFIG_SERIAL_8250_CONSOLE