From patchwork Sat Feb 5 02:18:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 532431 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p14ISplj015651 for ; Fri, 4 Feb 2011 18:33:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751247Ab1BDSdX (ORCPT ); Fri, 4 Feb 2011 13:33:23 -0500 Received: from db3ehsobe001.messaging.microsoft.com ([213.199.154.139]:22552 "EHLO DB3EHSOBE001.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751167Ab1BDSdW (ORCPT ); Fri, 4 Feb 2011 13:33:22 -0500 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 04 Feb 2011 18:33:23 +0000 (UTC) X-Greylist: delayed 903 seconds by postgrey-1.27 at vger.kernel.org; Fri, 04 Feb 2011 13:33:22 EST Received: from mail22-db3-R.bigfish.com (10.3.81.251) by DB3EHSOBE001.bigfish.com (10.3.84.21) with Microsoft SMTP Server id 14.1.225.8; Fri, 4 Feb 2011 18:18:18 +0000 Received: from mail22-db3 (localhost.localdomain [127.0.0.1]) by mail22-db3-R.bigfish.com (Postfix) with ESMTP id 81A2B118145; Fri, 4 Feb 2011 18:18:18 +0000 (UTC) X-SpamScore: -3 X-BigFish: VS-3(zzbb2cKzz1202hzz8275bhz2dh2a8h668h64h) X-Spam-TCS-SCL: 3:0 X-Forefront-Antispam-Report: KIP:(null); UIP:(null); IPVD:NLI; H:de01egw02.freescale.net; RD:de01egw02.freescale.net; EFVD:NLI Received: from mail22-db3 (localhost.localdomain [127.0.0.1]) by mail22-db3 (MessageSwitch) id 129684349826014_19359; Fri, 4 Feb 2011 18:18:18 +0000 (UTC) Received: from DB3EHSMHS002.bigfish.com (unknown [10.3.81.248]) by mail22-db3.bigfish.com (Postfix) with ESMTP id EDDC4187804F; Fri, 4 Feb 2011 18:18:17 +0000 (UTC) Received: from de01egw02.freescale.net (192.88.165.103) by DB3EHSMHS002.bigfish.com (10.3.87.102) with Microsoft SMTP Server (TLS) id 14.1.225.8; Fri, 4 Feb 2011 18:18:13 +0000 Received: from az33smr02.freescale.net (az33smr02.freescale.net [10.64.34.200]) by de01egw02.freescale.net (8.14.3/8.14.3) with ESMTP id p14IICQh008557; Fri, 4 Feb 2011 11:18:12 -0700 (MST) Received: from S2101-09.ap.freescale.net (mvp-10-192-184-3.ap.freescale.net [10.192.184.3]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id p14IHlCW020234; Fri, 4 Feb 2011 12:18:09 -0600 (CST) From: Shawn Guo To: , , , , CC: Shawn Guo Subject: [PATCH 7/7] ARM: mxs/mx28evk: add mmc device Date: Sat, 5 Feb 2011 10:18:47 +0800 Message-ID: <1296872327-21166-8-git-send-email-shawn.guo@freescale.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1296872327-21166-1-git-send-email-shawn.guo@freescale.com> References: <1296872327-21166-1-git-send-email-shawn.guo@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig index 3f400cb..b00dd2a 100644 --- a/arch/arm/mach-mxs/Kconfig +++ b/arch/arm/mach-mxs/Kconfig @@ -32,6 +32,7 @@ config MACH_MX28EVK select MXS_HAVE_AMBA_DUART select MXS_HAVE_PLATFORM_DMA select MXS_HAVE_PLATFORM_FEC + select MXS_HAVE_PLATFORM_MMC select MXS_OCOTP default y help diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c index 04ddec1..9752ec2 100644 --- a/arch/arm/mach-mxs/mach-mx28evk.c +++ b/arch/arm/mach-mxs/mach-mx28evk.c @@ -28,8 +28,13 @@ #include "devices-mx28.h" #include "gpio.h" -#define MX28EVK_FEC_PHY_POWER MXS_GPIO_NR(2, 15) -#define MX28EVK_FEC_PHY_RESET MXS_GPIO_NR(4, 13) +#define MX28EVK_FEC_PHY_POWER MXS_GPIO_NR(2, 15) +#define MX28EVK_FEC_PHY_RESET MXS_GPIO_NR(4, 13) + +#define MX28EVK_MMC0_WRITE_PROTECT MXS_GPIO_NR(2, 12) +#define MX28EVK_MMC1_WRITE_PROTECT MXS_GPIO_NR(0, 28) +#define MX28EVK_MMC0_SLOT_POWER MXS_GPIO_NR(3, 28) +#define MX28EVK_MMC1_SLOT_POWER MXS_GPIO_NR(3, 29) static const iomux_cfg_t mx28evk_pads[] __initconst = { /* duart */ @@ -76,6 +81,66 @@ static const iomux_cfg_t mx28evk_pads[] __initconst = { /* phy reset line */ MX28_PAD_ENET0_RX_CLK__GPIO_4_13 | (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), + + /* mmc0 */ + MX28_PAD_SSP0_DATA0__SSP0_D0 | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), + MX28_PAD_SSP0_DATA1__SSP0_D1 | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), + MX28_PAD_SSP0_DATA2__SSP0_D2 | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), + MX28_PAD_SSP0_DATA3__SSP0_D3 | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), + MX28_PAD_SSP0_DATA4__SSP0_D4 | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), + MX28_PAD_SSP0_DATA5__SSP0_D5 | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), + MX28_PAD_SSP0_DATA6__SSP0_D6 | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), + MX28_PAD_SSP0_DATA7__SSP0_D7 | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), + MX28_PAD_SSP0_CMD__SSP0_CMD | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), + MX28_PAD_SSP0_DETECT__SSP0_CARD_DETECT | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), + MX28_PAD_SSP0_SCK__SSP0_SCK | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), + /* write protect */ + MX28_PAD_SSP1_SCK__GPIO_2_12 | + (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), + /* slot power enable */ + MX28_PAD_PWM3__GPIO_3_28 | + (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), + + /* mmc1 */ + MX28_PAD_GPMI_D00__SSP1_D0 | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), + MX28_PAD_GPMI_D01__SSP1_D1 | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), + MX28_PAD_GPMI_D02__SSP1_D2 | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), + MX28_PAD_GPMI_D03__SSP1_D3 | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), + MX28_PAD_GPMI_D04__SSP1_D4 | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), + MX28_PAD_GPMI_D05__SSP1_D5 | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), + MX28_PAD_GPMI_D06__SSP1_D6 | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), + MX28_PAD_GPMI_D07__SSP1_D7 | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), + MX28_PAD_GPMI_RDY1__SSP1_CMD | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), + MX28_PAD_GPMI_RDY0__SSP1_CARD_DETECT | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), + MX28_PAD_GPMI_WRN__SSP1_SCK | + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), + /* write protect */ + MX28_PAD_GPMI_RESETN__GPIO_0_28 | + (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), + /* slot power enable */ + MX28_PAD_PWM4__GPIO_3_29 | + (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), }; /* fec */ @@ -159,6 +224,34 @@ error: return -ETIMEDOUT; } +/* mmc */ +static void __init mx28evk_mmc_slot_poweron(int gpio) +{ + int ret; + + ret = gpio_request(gpio, "mmc-slot-power"); + if (ret) { + pr_err("Failed to request gpio mmc-slot-power: %d\n", ret); + return; + } + + ret = gpio_direction_output(gpio, 0); + if (ret) { + pr_err("Failed to drive gpio mmc-slot-power: %d\n", ret); + return; + } +} + +static struct mxs_mmc_platform_data mx28_mmc_pdata[] __initdata = { + { + /* mmc0 */ + .wp_gpio = MX28EVK_MMC0_WRITE_PROTECT, + }, { + /* mmc1 */ + .wp_gpio = MX28EVK_MMC1_WRITE_PROTECT, + }, +}; + static void __init mx28evk_init(void) { mxs_iomux_setup_multiple_pads(mx28evk_pads, ARRAY_SIZE(mx28evk_pads)); @@ -173,6 +266,11 @@ static void __init mx28evk_init(void) mx28_add_apbh_dma(); mx28_add_apbx_dma(); + mx28evk_mmc_slot_poweron(MX28EVK_MMC0_SLOT_POWER); + mx28_add_mmc(0, &mx28_mmc_pdata[0]); + mx28evk_mmc_slot_poweron(MX28EVK_MMC1_SLOT_POWER); + mx28_add_mmc(1, &mx28_mmc_pdata[0]); + if (mx28evk_fec_get_mac()) pr_warn("%s: failed on fec mac setup\n", __func__);