diff mbox

[1/3] davinci: Add MMC/SD support for DA830/OMAP-L137 EVM

Message ID 20090904181404.GA24892@mag.az.mvista.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Mark A. Greer Sept. 4, 2009, 6:14 p.m. UTC
From: David A. Griego <dgriego@mvista.com>

Add pinmux settings, etc. to enable the MMC/SC hardware.

Signed-off-by: David A. Griego <dgriego@mvista.com>
Signed-off-by: Mark A. Greer <mgreer@mvista.com>
---
 arch/arm/mach-davinci/board-da830-evm.c |   44 +++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)

Comments

Kevin Hilman Sept. 14, 2009, 9:59 p.m. UTC | #1
"Mark A. Greer" <mgreer@mvista.com> writes:

> From: David A. Griego <dgriego@mvista.com>
>
> Add pinmux settings, etc. to enable the MMC/SC hardware.
>
> Signed-off-by: David A. Griego <dgriego@mvista.com>
> Signed-off-by: Mark A. Greer <mgreer@mvista.com>

Hi Mark, can you refresh these against current master?  These have
several conflicts with your register_mcasp() change.

Other than that, the series looks fine to me.

Thanks,

Kevin


> --- arch/arm/mach-davinci/board-da830-evm.c | 44
> +++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0
> deletions(-)
>
> diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
> index bfbb639..44b6776 100644
> --- a/arch/arm/mach-davinci/board-da830-evm.c
> +++ b/arch/arm/mach-davinci/board-da830-evm.c
> @@ -22,6 +22,8 @@
>  #include <mach/common.h>
>  #include <mach/irqs.h>
>  #include <mach/cp_intc.h>
> +#include <mach/mux.h>
> +#include <mach/gpio.h>
>  #include <mach/da8xx.h>
>  #include <mach/asp.h>
>  
> @@ -74,6 +76,38 @@ static struct snd_platform_data da830_evm_snd_data = {
>  	.rxnumevt	= 1,
>  };
>  
> +/*
> + * GPIO2[1] is used as MMC_SD_WP and GPIO2[2] as MMC_SD_INS.
> + */
> +static const short da830_evm_mmc_sd_pins[] = {
> +	DA830_MMCSD_DAT_0, DA830_MMCSD_DAT_1, DA830_MMCSD_DAT_2,
> +	DA830_MMCSD_DAT_3, DA830_MMCSD_DAT_4, DA830_MMCSD_DAT_5,
> +	DA830_MMCSD_DAT_6, DA830_MMCSD_DAT_7, DA830_MMCSD_CLK,
> +	DA830_MMCSD_CMD,   DA830_GPIO2_1,     DA830_GPIO2_2,
> +	-1
> +};
> +
> +static int da830_evm_mmc_get_ro(int index)
> +{
> +	int val, status, gpio_num = 33;
> +
> +	status = gpio_request(gpio_num, "MMC WP\n");
> +	if (status < 0) {
> +		pr_warning("%s can not open GPIO %d\n", __func__, gpio_num);
> +		return 0;
> +	}
> +	gpio_direction_input(gpio_num);
> +	val = gpio_get_value(gpio_num);
> +	gpio_free(gpio_num);
> +	return val;
> +}
> +
> +static struct davinci_mmc_config da830_evm_mmc_config = {
> +	.get_ro			= da830_evm_mmc_get_ro,
> +	.wires			= 4,
> +	.version		= MMC_CTLR_VERSION_2,
> +};
> +
>  static __init void da830_evm_init(void)
>  {
>  	struct davinci_soc_info *soc_info = &davinci_soc_info;
> @@ -123,6 +157,16 @@ static __init void da830_evm_init(void)
>  				ret);
>  
>  	da8xx_init_mcasp(1, &da830_evm_snd_data);
> +
> +	ret = da8xx_pinmux_setup(da830_evm_mmc_sd_pins);
> +	if (ret)
> +		pr_warning("da830_evm_init: mmc/sd mux setup failed: %d\n",
> +				ret);
> +
> +	ret = da8xx_register_mmcsd0(&da830_evm_mmc_config);
> +	if (ret)
> +		pr_warning("da830_evm_init: mmc/sd registration failed: %d\n",
> +				ret);
>  }
>  
>  #ifdef CONFIG_SERIAL_8250_CONSOLE
> -- 
> 1.6.2.5.182.ga808d
>
>
> _______________________________________________
> Davinci-linux-open-source mailing list
> Davinci-linux-open-source@linux.davincidsp.com
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Mark A. Greer Sept. 14, 2009, 10:10 p.m. UTC | #2
On Mon, Sep 14, 2009 at 02:59:31PM -0700, Kevin Hilman wrote:
> "Mark A. Greer" <mgreer@mvista.com> writes:
> 
> > From: David A. Griego <dgriego@mvista.com>
> >
> > Add pinmux settings, etc. to enable the MMC/SC hardware.
> >
> > Signed-off-by: David A. Griego <dgriego@mvista.com>
> > Signed-off-by: Mark A. Greer <mgreer@mvista.com>
> 
> Hi Mark, can you refresh these against current master?  These have
> several conflicts with your register_mcasp() change.
> 
> Other than that, the series looks fine to me.

Yes, stay tuned...
diff mbox

Patch

diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index bfbb639..44b6776 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -22,6 +22,8 @@ 
 #include <mach/common.h>
 #include <mach/irqs.h>
 #include <mach/cp_intc.h>
+#include <mach/mux.h>
+#include <mach/gpio.h>
 #include <mach/da8xx.h>
 #include <mach/asp.h>
 
@@ -74,6 +76,38 @@  static struct snd_platform_data da830_evm_snd_data = {
 	.rxnumevt	= 1,
 };
 
+/*
+ * GPIO2[1] is used as MMC_SD_WP and GPIO2[2] as MMC_SD_INS.
+ */
+static const short da830_evm_mmc_sd_pins[] = {
+	DA830_MMCSD_DAT_0, DA830_MMCSD_DAT_1, DA830_MMCSD_DAT_2,
+	DA830_MMCSD_DAT_3, DA830_MMCSD_DAT_4, DA830_MMCSD_DAT_5,
+	DA830_MMCSD_DAT_6, DA830_MMCSD_DAT_7, DA830_MMCSD_CLK,
+	DA830_MMCSD_CMD,   DA830_GPIO2_1,     DA830_GPIO2_2,
+	-1
+};
+
+static int da830_evm_mmc_get_ro(int index)
+{
+	int val, status, gpio_num = 33;
+
+	status = gpio_request(gpio_num, "MMC WP\n");
+	if (status < 0) {
+		pr_warning("%s can not open GPIO %d\n", __func__, gpio_num);
+		return 0;
+	}
+	gpio_direction_input(gpio_num);
+	val = gpio_get_value(gpio_num);
+	gpio_free(gpio_num);
+	return val;
+}
+
+static struct davinci_mmc_config da830_evm_mmc_config = {
+	.get_ro			= da830_evm_mmc_get_ro,
+	.wires			= 4,
+	.version		= MMC_CTLR_VERSION_2,
+};
+
 static __init void da830_evm_init(void)
 {
 	struct davinci_soc_info *soc_info = &davinci_soc_info;
@@ -123,6 +157,16 @@  static __init void da830_evm_init(void)
 				ret);
 
 	da8xx_init_mcasp(1, &da830_evm_snd_data);
+
+	ret = da8xx_pinmux_setup(da830_evm_mmc_sd_pins);
+	if (ret)
+		pr_warning("da830_evm_init: mmc/sd mux setup failed: %d\n",
+				ret);
+
+	ret = da8xx_register_mmcsd0(&da830_evm_mmc_config);
+	if (ret)
+		pr_warning("da830_evm_init: mmc/sd registration failed: %d\n",
+				ret);
 }
 
 #ifdef CONFIG_SERIAL_8250_CONSOLE