From: stigge@antcom.de (Roland Stigge)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 10/14] ARM: LPC32xx: Add MMC controller support
Date: Mon, 11 Jun 2012 13:02:13 +0200 [thread overview]
Message-ID: <1339412537-24485-11-git-send-email-stigge@antcom.de> (raw)
In-Reply-To: <1339412537-24485-1-git-send-email-stigge@antcom.de>
This patch adds support for the MMC controller of the LPC32xx SoC to the
platform initialization via the pl08x primecell driver. Lacking more complete
DT support, done via DT auxdata.
Signed-off-by: Roland Stigge <stigge@antcom.de>
---
arch/arm/mach-lpc32xx/phy3250.c | 43 ++++++++++++++++++++++++++++++++++++----
1 file changed, 39 insertions(+), 4 deletions(-)
--- linux-2.6.orig/arch/arm/mach-lpc32xx/phy3250.c
+++ linux-2.6/arch/arm/mach-lpc32xx/phy3250.c
@@ -30,12 +30,13 @@
#include <linux/amba/bus.h>
#include <linux/amba/clcd.h>
#include <linux/amba/pl022.h>
+#include <linux/amba/pl08x.h>
+#include <linux/amba/mmci.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h>
#include <linux/clk.h>
-#include <linux/amba/pl08x.h>
#include <asm/setup.h>
#include <asm/mach-types.h>
@@ -50,9 +51,12 @@
/*
* Mapped GPIOLIB GPIOs
*/
-#define SPI0_CS_GPIO LPC32XX_GPIO(LPC32XX_GPIO_P3_GRP, 5)
-#define LCD_POWER_GPIO LPC32XX_GPIO(LPC32XX_GPO_P3_GRP, 0)
-#define BKL_POWER_GPIO LPC32XX_GPIO(LPC32XX_GPO_P3_GRP, 4)
+#define SPI0_CS_GPIO LPC32XX_GPIO(LPC32XX_GPIO_P3_GRP, 5)
+#define LCD_POWER_GPIO LPC32XX_GPIO(LPC32XX_GPO_P3_GRP, 0)
+#define BKL_POWER_GPIO LPC32XX_GPIO(LPC32XX_GPO_P3_GRP, 4)
+#define MMC_PWR_ENABLE_GPIO LPC32XX_GPIO(LPC32XX_GPO_P3_GRP, 5)
+#define MMC_CD_GPIO LPC32XX_GPIO(LPC32XX_GPIO_P3_GRP, 1)
+#define MMC_WP_GPIO LPC32XX_GPIO(LPC32XX_GPIO_P3_GRP, 0)
/*
* AMBA LCD controller
@@ -259,11 +263,32 @@ static struct pl08x_platform_data pl08x_
.mem_buses = PL08X_AHB1,
};
+static int mmc_handle_ios(struct device *dev, struct mmc_ios *ios)
+{
+ /* Only on and off are supported */
+ if (ios->power_mode == MMC_POWER_OFF)
+ gpio_set_value(MMC_PWR_ENABLE_GPIO, 0);
+ else
+ gpio_set_value(MMC_PWR_ENABLE_GPIO, 1);
+ return 0;
+}
+
+static struct mmci_platform_data lpc32xx_mmci_data = {
+ .ocr_mask = MMC_VDD_30_31 | MMC_VDD_31_32 |
+ MMC_VDD_32_33 | MMC_VDD_33_34,
+ .ios_handler = mmc_handle_ios,
+ .dma_filter = NULL,
+ /* No DMA for now since AMBA PL080 dmaengine driver only does scatter
+ * gather, and the MMCI driver doesn't do it this way */
+};
+
static const struct of_dev_auxdata lpc32xx_auxdata_lookup[] __initconst = {
OF_DEV_AUXDATA("arm,pl022", 0x20084000, "dev:ssp0", &lpc32xx_ssp0_data),
OF_DEV_AUXDATA("arm,pl022", 0x2008C000, "dev:ssp1", &lpc32xx_ssp1_data),
OF_DEV_AUXDATA("arm,pl110", 0x31040000, "dev:clcd", &lpc32xx_clcd_data),
OF_DEV_AUXDATA("arm,pl080", 0x31000000, "pl08xdmac", &pl08x_pd),
+ OF_DEV_AUXDATA("arm,pl18x", 0x20098000, "20098000.sd",
+ &lpc32xx_mmci_data),
{ }
};
@@ -307,6 +332,11 @@ static void __init lpc3250_machine_init(
* detection or a data fault will occur, so enable the clocks
* here.
*/
+ tmp = __raw_readl(LPC32XX_CLKPWR_MS_CTRL);
+ tmp |= LPC32XX_CLKPWR_MSCARD_SDCARD_EN |
+ LPC32XX_CLKPWR_MSCARD_MSDIO_PU_EN;
+ __raw_writel(tmp, LPC32XX_CLKPWR_MS_CTRL);
+
tmp = __raw_readl(LPC32XX_CLKPWR_LCDCLK_CTRL);
__raw_writel((tmp | LPC32XX_CLKPWR_LCDCTRL_CLK_EN),
LPC32XX_CLKPWR_LCDCLK_CTRL);
@@ -334,6 +364,11 @@ static void __init lpc3250_machine_init(
else if (gpio_direction_output(SPI0_CS_GPIO, 1))
printk(KERN_ERR "Error setting gpio %u to output",
SPI0_CS_GPIO);
+
+ if (gpio_request(MMC_PWR_ENABLE_GPIO, "mmc_power_en"))
+ pr_err("Error requesting gpio %u", MMC_PWR_ENABLE_GPIO);
+ else if (gpio_direction_output(MMC_PWR_ENABLE_GPIO, 1))
+ pr_err("Error setting gpio %u to output", MMC_PWR_ENABLE_GPIO);
}
static char const *lpc32xx_dt_compat[] __initdata = {
next prev parent reply other threads:[~2012-06-11 11:02 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-11 11:02 [PATCH 0/14] ARM: LPC32xx specific updates for next Roland Stigge
2012-06-11 11:02 ` [PATCH 1/14] ARM: LPC32xx: Add NAND flash timing to PHY3250 board dts Roland Stigge
2012-06-11 22:19 ` Alexandre Pereira da Silva
2012-06-11 11:02 ` [PATCH 2/14] ARM: LPC32xx: Clock initialization for NAND controllers Roland Stigge
2012-06-11 11:02 ` [PATCH 3/14] ARM: LPC32xx: Remove SLC controller initialization from platform init Roland Stigge
2012-06-11 22:19 ` Alexandre Pereira da Silva
2012-06-11 11:02 ` [PATCH 4/14] ARM: LPC32xx: Add DMA configuration to platform data Roland Stigge
2012-06-11 11:10 ` Russell King - ARM Linux
2012-06-14 17:07 ` Roland Stigge
2012-06-11 11:02 ` [PATCH 5/14] ARM: LPC32xx: Adjust dtsi file for MLC controller configuration Roland Stigge
2012-06-11 22:20 ` Alexandre Pereira da Silva
2012-06-11 11:02 ` [PATCH 6/14] ARM: LPC32xx: Add dts for EA3250 reference board Roland Stigge
2012-06-11 22:20 ` Alexandre Pereira da Silva
2012-06-11 11:02 ` [PATCH 7/14] ARM: LPC32xx: DTS adjustment for key matrix controller Roland Stigge
2012-06-11 22:21 ` Alexandre Pereira da Silva
2012-06-11 11:02 ` [PATCH 8/14] ARM: LPC32xx: Clock " Roland Stigge
2012-06-11 14:16 ` Arnd Bergmann
2012-06-11 14:34 ` Roland Stigge
2012-06-11 14:58 ` Arnd Bergmann
2012-06-11 11:02 ` [PATCH 9/14] ARM: LPC32xx: Defconfig update Roland Stigge
2012-06-11 22:22 ` Alexandre Pereira da Silva
2012-06-11 11:02 ` Roland Stigge [this message]
2012-06-11 22:23 ` [PATCH 10/14] ARM: LPC32xx: Add MMC controller support Alexandre Pereira da Silva
2012-06-11 11:02 ` [PATCH 11/14] ARM: LPC32xx: DTS adjustment for using pl18x primecell Roland Stigge
2012-06-11 14:14 ` Arnd Bergmann
2012-06-11 14:28 ` Roland Stigge
2012-06-11 14:57 ` Arnd Bergmann
2012-06-11 11:02 ` [PATCH 12/14] ARM: LPC32xx: DT conversion of Standard UARTs Roland Stigge
2012-06-11 22:23 ` Alexandre Pereira da Silva
2012-06-11 11:02 ` [PATCH 13/14] ARM: LPC32xx: High Speed UART configuration via DT Roland Stigge
2012-06-11 22:25 ` Alexandre Pereira da Silva
2012-06-11 11:02 ` [PATCH 14/14] ARM: LPC32xx: Remove mach specific ARCH_NR_GPIOS, use default Roland Stigge
2012-06-11 22:24 ` Alexandre Pereira da Silva
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=1339412537-24485-11-git-send-email-stigge@antcom.de \
--to=stigge@antcom.de \
--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).