From patchwork Fri Sep 4 18:14:04 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: 45716 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 n84IG59L009327 for ; Fri, 4 Sep 2009 18:16:06 GMT Received: from dlep35.itg.ti.com ([157.170.170.118]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id n84IEMRM019437; Fri, 4 Sep 2009 13:14:27 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep35.itg.ti.com (8.13.7/8.13.7) with ESMTP id n84IELAr026996; Fri, 4 Sep 2009 13:14:21 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 8939E80627; Fri, 4 Sep 2009 13:14:21 -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 1BCA580626 for ; Fri, 4 Sep 2009 13:14:20 -0500 (CDT) Received: from neches.ext.ti.com (localhost [127.0.0.1]) by dflp51.itg.ti.com (8.13.7/8.13.7) with ESMTP id n84IEJTZ009095 for ; Fri, 4 Sep 2009 13:14:19 -0500 (CDT) Received: from mail8-tx2-R.bigfish.com (mail-tx2.bigfish.com [65.55.88.111]) by neches.ext.ti.com (8.13.7/8.13.7) with ESMTP id n84IEEGH007522 for ; Fri, 4 Sep 2009 13:14:19 -0500 Received: from mail8-tx2 (localhost.localdomain [127.0.0.1]) by mail8-tx2-R.bigfish.com (Postfix) with ESMTP id 998B914183C3 for ; Fri, 4 Sep 2009 18:14:14 +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 mail8-tx2 (MessageSwitch) id 1252088052928106_7766; Fri, 4 Sep 2009 18:14:12 +0000 (UCT) Received: from gateway-1237.mvista.com (gateway-1237.mvista.com [63.81.120.158]) by mail8-tx2.bigfish.com (Postfix) with ESMTP id A410AE5804D for ; Fri, 4 Sep 2009 18:14:12 +0000 (UTC) Received: from mag.az.mvista.com (mag.az.mvista.com [10.50.1.99]) by hermes.mvista.com (Postfix) with ESMTP id 623561B8ED for ; Fri, 4 Sep 2009 11:14:04 -0700 (PDT) Received: from mgreer by mag.az.mvista.com with local (Exim 4.69) (envelope-from ) id 1MjdIS-0006Tt-8x for Davinci-linux-open-source@linux.davincidsp.com; Fri, 04 Sep 2009 11:14:04 -0700 Date: Fri, 4 Sep 2009 11:14:04 -0700 From: "Mark A. Greer" To: Davinci List Message-ID: <20090904181404.GA24892@mag.az.mvista.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.17+20080114 (2008-01-14) Cc: Subject: [PATCH 1/3] 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 | 44 +++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c index bfbb639..44b6776 100644 --- a/arch/arm/mach-davinci/board-da830-evm.c +++ b/arch/arm/mach-davinci/board-da830-evm.c @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include @@ -74,6 +76,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; @@ -123,6 +157,16 @@ static __init void da830_evm_init(void) ret); da8xx_init_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