From: "Daniel Glöckner" <dg@emlix.com>
To: Chris Zankel <chris@zankel.net>,
David Brownell <dbrownell@users.sourceforge.net>
Cc: spi-devel-general@lists.sourceforge.net,
linux-kernel@vger.kernel.org, "Daniel Glöckner" <dg@emlix.com>
Subject: [patch 3/6] xtensa: add spi mmc host to s6105 platform
Date: Mon, 23 Mar 2009 16:34:19 +0100 [thread overview]
Message-ID: <1237822462-32109-3-git-send-email-dg@emlix.com> (raw)
In-Reply-To: <1237822462-32109-1-git-send-email-dg@emlix.com>
Signed-off-by: Daniel Glöckner <dg@emlix.com>
---
arch/xtensa/platforms/s6105/device.c | 55 ++++++++++++++++++++++++++++++++++
1 files changed, 55 insertions(+), 0 deletions(-)
diff --git a/arch/xtensa/platforms/s6105/device.c b/arch/xtensa/platforms/s6105/device.c
index a7ea916..789448e 100644
--- a/arch/xtensa/platforms/s6105/device.c
+++ b/arch/xtensa/platforms/s6105/device.c
@@ -11,9 +11,11 @@
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/phy.h>
+#include <linux/mmc/host.h>
#include <linux/platform_device.h>
#include <linux/serial.h>
#include <linux/serial_8250.h>
+#include <linux/spi/mmc_spi.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi_s6000.h>
@@ -209,7 +211,60 @@ static __devinitdata struct s6_spi_platform_data s6_spi_pdata = {
#define S6_SPI_CS_EXPANSION 3
#define S6_SPI_CS_MMC_SLOT 4
+static int __devinit s6_init_mmc_host(struct device *spi,
+ irqreturn_t (*handler)(int, void *),
+ void *mmc)
+{
+ int ret;
+ ret = gpio_request(GPIO_SD_WP, "mmc_wp");
+ if (ret < 0)
+ return ret;
+ ret = gpio_request(GPIO_SD_IRQ, "mmc_irq");
+ if (ret < 0)
+ return ret;
+ ret = gpio_direction_input(GPIO_SD_WP);
+ if (ret < 0)
+ return ret;
+ ret = gpio_direction_input(GPIO_SD_IRQ);
+ if (ret < 0)
+ return ret;
+ ret = gpio_to_irq(GPIO_SD_IRQ);
+ if (ret < 0)
+ return ret;
+ ret = request_irq(ret, handler,
+ IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+ "mmc_slot", mmc);
+ return ret;
+}
+
+static void __devexit s6_exit_mmc_host(struct device *spi, void *mmc)
+{
+ free_irq(gpio_to_irq(GPIO_SD_IRQ), mmc);
+ gpio_free(GPIO_SD_IRQ);
+ gpio_free(GPIO_SD_WP);
+}
+
+static int s6_mmc_get_ro(struct device *spi)
+{
+ return gpio_get_value(GPIO_SD_WP);
+}
+
+static struct mmc_spi_platform_data s6_spi_mmc_pdata = {
+ .caps = 0,
+ .ocr_mask = MMC_VDD_32_33,
+ .init = s6_init_mmc_host,
+ .exit = __devexit_p(s6_exit_mmc_host),
+ .get_ro = s6_mmc_get_ro,
+};
+
static struct spi_board_info __initdata s6_spi_devices[] = {
+ {
+ .modalias = "mmc_spi",
+ .platform_data = &s6_spi_mmc_pdata,
+ .bus_num = S6_SPI_BUS_NUM,
+ .chip_select = S6_SPI_CS_MMC_SLOT,
+ .max_speed_hz = 50000000,
+ },
};
static struct platform_device platform_devices[] = {
--
1.6.2.107.ge47ee
next prev parent reply other threads:[~2009-03-23 15:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-23 15:34 [patch 1/6] spi: s6000 spi host driver Daniel Glöckner
2009-03-23 15:34 ` [patch 2/6] xtensa: add s6000 spi host to s6105 platform Daniel Glöckner
2009-03-23 15:34 ` Daniel Glöckner [this message]
2009-03-24 20:09 ` [patch 3/6] xtensa: add spi mmc " David Brownell
2009-04-02 10:31 ` Daniel Glöckner
2009-03-23 15:34 ` [patch 4/6] xtensa: add m25p80 " Daniel Glöckner
2009-03-23 15:34 ` [patch 5/6] xtensa: enable s6000 spi host in s6105_defconfig Daniel Glöckner
2009-03-23 15:37 ` Daniel Glöckner
2009-03-23 15:34 ` [patch 6/6] xtensa: enable spi mmc " Daniel Glöckner
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=1237822462-32109-3-git-send-email-dg@emlix.com \
--to=dg@emlix.com \
--cc=chris@zankel.net \
--cc=dbrownell@users.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=spi-devel-general@lists.sourceforge.net \
/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).