From: GNUtoo@no-log.org (Denis 'GNUtoo' Carikli)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] imx: mach-bug: add sdio platform data
Date: Wed, 25 May 2011 21:32:23 +0200 [thread overview]
Message-ID: <1306351943-7963-1-git-send-email-GNUtoo@no-log.org> (raw)
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
---
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 <mach/iomux-mx3.h>
#include <mach/hardware.h>
#include <mach/common.h>
+#include <mach/gpio.h>
+#include <mach/mx31.h>
#include <asm/mach/time.h>
#include <asm/mach/arch.h>
@@ -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)
--
1.7.1
next reply other threads:[~2011-05-25 19:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-25 19:32 Denis 'GNUtoo' Carikli [this message]
2011-05-25 19:44 ` [PATCH] imx: mach-bug: add sdio platform data Uwe Kleine-König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1306351943-7963-1-git-send-email-GNUtoo@no-log.org \
--to=gnutoo@no-log.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).