From patchwork Wed May 25 19:32:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis 'GNUtoo' Carikli X-Patchwork-Id: 97440 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from canuck.infradead.org (canuck.infradead.org [134.117.69.58]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BCC2CB6F88 for ; Thu, 26 May 2011 09:41:40 +1000 (EST) Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QPNH1-0003Kn-EV; Wed, 25 May 2011 23:13:55 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QPNGj-0002MR-VY for linux-arm-kernel@canuck.infradead.org; Wed, 25 May 2011 23:13:46 +0000 Received: from smtp202.alice.it ([82.57.200.98]) by casper.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QPKDg-0001cG-BC for linux-arm-kernel@lists.infradead.org; Wed, 25 May 2011 19:58:17 +0000 Received: from localhost.localdomain (95.244.3.148) by smtp202.alice.it (8.5.124.08) (authenticated as editempo@alice.it) id 4CC7FB5F039D7C32; Wed, 25 May 2011 21:32:27 +0200 From: Denis 'GNUtoo' Carikli To: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Subject: [PATCH] imx: mach-bug: add sdio platform data Date: Wed, 25 May 2011 21:32:23 +0200 Message-Id: <1306351943-7963-1-git-send-email-GNUtoo@no-log.org> X-Mailer: git-send-email 1.7.0.4 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110525_205816_591307_12849FFB X-CRM114-Status: GOOD ( 11.91 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2-r929478 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, low trust [82.57.200.98 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: bug-dev@lists.buglabs.net, Sascha Hauer , Denis 'GNUtoo' Carikli , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org Signed-off-by: Denis 'GNUtoo' Carikli --- arch/arm/mach-imx/mach-bug.c | 106 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 106 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-imx/mach-bug.c b/arch/arm/mach-imx/mach-bug.c index 42e4f07..b0d1536 100644 --- a/arch/arm/mach-imx/mach-bug.c +++ b/arch/arm/mach-imx/mach-bug.c @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include @@ -40,11 +42,115 @@ static const unsigned int bug_pins[] __initconst = { MX31_PIN_PC_BVD1__RXD5, }; +static int sdhc1_pins[] = { + MX31_PIN_SD1_DATA3__SD1_DATA3, + MX31_PIN_SD1_DATA2__SD1_DATA2, + MX31_PIN_SD1_DATA1__SD1_DATA1, + MX31_PIN_SD1_DATA0__SD1_DATA0, + MX31_PIN_SD1_CLK__SD1_CLK, + MX31_PIN_SD1_CMD__SD1_CMD, +}; + +static int sdhc2_pins[] = { + MX31_PIN_PC_PWRON__SD2_DATA3, + MX31_PIN_PC_VS1__SD2_DATA2, + MX31_PIN_PC_READY__SD2_DATA1, + MX31_PIN_PC_WAIT_B__SD2_DATA0, + MX31_PIN_PC_CD2_B__SD2_CLK, + MX31_PIN_PC_CD1_B__SD2_CMD, +}; + +static int mxc_bug_sdhc1_init(struct device *dev, irq_handler_t h, void *data) +{ + return mxc_iomux_setup_multiple_pins(sdhc1_pins, ARRAY_SIZE(sdhc1_pins), + "sdhc-1"); +} + +static void mxc_bug_sdhc1_exit(struct device *dev, void *data) +{ + mxc_iomux_release_multiple_pins(sdhc1_pins, ARRAY_SIZE(sdhc1_pins)); +} + +static int mxc_bug_sdhc2_init(struct device *dev, irq_handler_t h, void *data) +{ + return mxc_iomux_setup_multiple_pins(sdhc2_pins, ARRAY_SIZE(sdhc2_pins), + "sdhc-2"); +} + +static void mxc_bug_sdhc2_exit(struct device *dev, void *data) +{ + mxc_iomux_release_multiple_pins(sdhc2_pins, ARRAY_SIZE(sdhc2_pins)); +} + +/* No card and rw detection at the moment */ +static struct imxmmc_platform_data sdhc1_pdata = { + .init = mxc_bug_sdhc1_init, + .exit = mxc_bug_sdhc1_exit, + .ocr_avail = MMC_VDD_27_28 | MMC_VDD_28_29 | MMC_VDD_29_30 | + MMC_VDD_32_33 | MMC_VDD_33_34, +}; + +static struct imxmmc_platform_data sdhc2_pdata = { + .init = mxc_bug_sdhc2_init, + .exit = mxc_bug_sdhc2_exit, +}; + + +static struct resource mxcsdhc0_resources[] = { + { + .start = MX31_SDHC1_BASE_ADDR, + .end = MX31_SDHC1_BASE_ADDR + SZ_16K - 1, + .flags = IORESOURCE_MEM, + }, { + .start = MX31_INT_SDHC1, + .end = MX31_INT_SDHC1, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct resource mxcsdhc1_resources[] = { + { + .start = MX31_SDHC2_BASE_ADDR, + .end = MX31_SDHC2_BASE_ADDR + SZ_16K - 1, + .flags = IORESOURCE_MEM, + }, { + .start = MX31_INT_SDHC2, + .end = MX31_INT_SDHC2, + .flags = IORESOURCE_IRQ, + }, +}; + +struct platform_device mxcsdhc_device0 = { + .name = "mxc-mmc", + .id = 0, + .num_resources = ARRAY_SIZE(mxcsdhc0_resources), + .resource = mxcsdhc0_resources, +}; + +struct platform_device mxcsdhc_device1 = { + .name = "mxc-mmc", + .id = 1, + .num_resources = ARRAY_SIZE(mxcsdhc1_resources), + .resource = mxcsdhc1_resources, +}; + static void __init bug_board_init(void) { mxc_iomux_setup_multiple_pins(bug_pins, ARRAY_SIZE(bug_pins), "uart-4"); imx31_add_imx_uart4(&uart_pdata); + + /* Turn off Wifi by default */ + if ( !mxc_iomux_alloc_pin( + IOMUX_MODE(MX31_PIN_USB_BYP, IOMUX_CONFIG_GPIO), "bug-wifi") + ){ + if (!gpio_request(IOMUX_TO_GPIO(MX31_PIN_USB_BYP), + "bug-wifi")) + gpio_direction_output(IOMUX_TO_GPIO( + MX31_PIN_USB_BYP), 0); + } + mxc_register_device(&mxcsdhc_device0, &sdhc1_pdata); + mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata); } static void __init bug_timer_init(void)