diff mbox

davinci: Handle pinmux conflict between mmc/sd and nor flash

Message ID 1250201788-18826-1-git-send-email-sudhakar.raj@ti.com (mailing list archive)
State Accepted
Headers show

Commit Message

Rajashekhara, Sudhakar Aug. 13, 2009, 10:16 p.m. UTC
On DA850/OMAP-L138 EVM, MMC/SD and NOR Flash share
some of the AEMIF pins. This patch prints out a warning
during booting, if both MMC/SD and NOR Flash are enabled
in kernel menuconfig.

If both MMC/SD and NOR Flash are enabled, only MMC/SD
will work correctly.

Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
---
 This patch is dependent on the following patches which
 I have submitted earlier:
 [PATCH] davinci: Macro to convert GPIO signal to GPIO pin number
 [PATCH v3] davinci: Add platform support for da850/omap-l138 GLCD
 [PATCH v3] davinci: Add MMC/SD support for da850/omap-l138
 [PATCH v3] davinci: Add NAND flash support for DA850/OMAP-L138
 [PATCH v3] davinci: Add NOR flash support for da850/omap-l138 

 arch/arm/mach-davinci/board-da850-evm.c |   63 ++++++++++++++++++++----------
 1 files changed, 42 insertions(+), 21 deletions(-)

Comments

Kevin Hilman Aug. 13, 2009, 11:21 p.m. UTC | #1
Sudhakar Rajashekhara <sudhakar.raj@ti.com> writes:

> On DA850/OMAP-L138 EVM, MMC/SD and NOR Flash share
> some of the AEMIF pins. This patch prints out a warning
> during booting, if both MMC/SD and NOR Flash are enabled
> in kernel menuconfig.
>
> If both MMC/SD and NOR Flash are enabled, only MMC/SD
> will work correctly.
>
> Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
> ---
>  This patch is dependent on the following patches which
>  I have submitted earlier:
>  [PATCH] davinci: Macro to convert GPIO signal to GPIO pin number
>  [PATCH v3] davinci: Add platform support for da850/omap-l138 GLCD
>  [PATCH v3] davinci: Add MMC/SD support for da850/omap-l138
>  [PATCH v3] davinci: Add NAND flash support for DA850/OMAP-L138
>  [PATCH v3] davinci: Add NOR flash support for da850/omap-l138 

FYI for future reference.  When you have lots of patch dependencies
like this, it is simpler to send them as a series.  If you use
git-format-patch for a range of commits, it will automatically do
the 'PATCH x/y' formatting etc.

>  arch/arm/mach-davinci/board-da850-evm.c |   63 ++++++++++++++++++++----------
>  1 files changed, 42 insertions(+), 21 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> index 70a2f48..f2946a0 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -244,6 +244,20 @@ static void __init da850_evm_init_nor(void)
>  	iounmap(aemif_addr);
>  }
>  
> +#if defined(CONFIG_MTD_PHYSMAP) || \
> +    defined(CONFIG_MTD_PHYSMAP_MODULE)
> +#define HAS_NOR 1
> +#else
> +#define HAS_NOR 0
> +#endif
> +
> +#if defined(CONFIG_MMC_DAVINCI) || \
> +    defined(CONFIG_MMC_DAVINCI_MODULE)
> +#define HAS_MMC 1
> +#else
> +#define HAS_MMC 0
> +#endif
> +
>  static __init void da850_evm_init(void)
>  {
>  	struct davinci_soc_info *soc_info = &davinci_soc_info;
> @@ -298,27 +312,34 @@ static __init void da850_evm_init(void)
>  		pr_warning("da830_evm_init: watchdog registration failed: %d\n",
>  				ret);
>  
> -	ret = da8xx_pinmux_setup(da850_mmcsd0_pins);
> -	if (ret)
> -		pr_warning("da850_evm_init: mmcsd0 mux setup failed: %d\n",
> -				ret);
> -
> -	ret = gpio_request(DA850_MMCSD_CD_PIN, "MMC CD\n");
> -	if (ret)
> -		pr_warning("da850_evm_init: can not open GPIO %d\n",
> -				DA850_MMCSD_CD_PIN);
> -	gpio_direction_input(DA850_MMCSD_CD_PIN);
> -
> -	ret = gpio_request(DA850_MMCSD_WP_PIN, "MMC WP\n");
> -	if (ret)
> -		pr_warning("da850_evm_init: can not open GPIO %d\n",
> -				DA850_MMCSD_WP_PIN);
> -	gpio_direction_input(DA850_MMCSD_WP_PIN);
> -
> -	ret = da8xx_register_mmcsd0(&da850_mmc_config);
> -	if (ret)
> -		pr_warning("da850_evm_init: mmcsd0 registration failed: %d\n",
> -				ret);
> +	if (HAS_MMC) {
> +		if (HAS_NOR)
> +			pr_warning("WARNING: both NOR Flash and MMC/SD are "
> +				"enabled, but they share AEMIF pins.\n"
> +				"\tDisable one of them.\n");
> +

Hmm, this isn't quite right.  MMC will never be configured unless NOR
is enabled also.

I think you want the WARNING inside the double-if, but the
mux/gpio/init stuff to always happen.  Based on init order, you should
be able to report which one will not work.

Kevin

> +		ret = da8xx_pinmux_setup(da850_mmcsd0_pins);
> +		if (ret)
> +			pr_warning("da850_evm_init: mmcsd0 mux setup failed:"
> +					" %d\n", ret);
> +
> +		ret = gpio_request(DA850_MMCSD_CD_PIN, "MMC CD\n");
> +		if (ret)
> +			pr_warning("da850_evm_init: can not open GPIO %d\n",
> +					DA850_MMCSD_CD_PIN);
> +		gpio_direction_input(DA850_MMCSD_CD_PIN);
> +
> +		ret = gpio_request(DA850_MMCSD_WP_PIN, "MMC WP\n");
> +		if (ret)
> +			pr_warning("da850_evm_init: can not open GPIO %d\n",
> +					DA850_MMCSD_WP_PIN);
> +		gpio_direction_input(DA850_MMCSD_WP_PIN);
> +
> +		ret = da8xx_register_mmcsd0(&da850_mmc_config);
> +		if (ret)
> +			pr_warning("da850_evm_init: mmcsd0 registration failed:"
> +					" %d\n", ret);
> +	}
>  
>  	davinci_serial_init(&da850_evm_uart_config);
>  
> -- 
> 1.5.6
>
> _______________________________________________
> Davinci-linux-open-source mailing list
> Davinci-linux-open-source@linux.davincidsp.com
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Rajashekhara, Sudhakar Aug. 14, 2009, 1:46 p.m. UTC | #2
On Fri, Aug 14, 2009 at 04:51:05, Kevin Hilman wrote:
> Sudhakar Rajashekhara <sudhakar.raj@ti.com> writes:
> 
> > On DA850/OMAP-L138 EVM, MMC/SD and NOR Flash share
> > some of the AEMIF pins. This patch prints out a warning
> > during booting, if both MMC/SD and NOR Flash are enabled
> > in kernel menuconfig.
> >
> > If both MMC/SD and NOR Flash are enabled, only MMC/SD
> > will work correctly.
> >
> > Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
> > ---
> >  This patch is dependent on the following patches which
> >  I have submitted earlier:
> >  [PATCH] davinci: Macro to convert GPIO signal to GPIO pin number
> >  [PATCH v3] davinci: Add platform support for da850/omap-l138 GLCD
> >  [PATCH v3] davinci: Add MMC/SD support for da850/omap-l138
> >  [PATCH v3] davinci: Add NAND flash support for DA850/OMAP-L138
> >  [PATCH v3] davinci: Add NOR flash support for da850/omap-l138 
> 
> FYI for future reference.  When you have lots of patch dependencies
> like this, it is simpler to send them as a series.  If you use
> git-format-patch for a range of commits, it will automatically do
> the 'PATCH x/y' formatting etc.
> 

In this case, in the series if one patch needs modifications
then do I need to re-submit the whole series again?

> >  arch/arm/mach-davinci/board-da850-evm.c |   63 ++++++++++++++++++++----------
> >  1 files changed, 42 insertions(+), 21 deletions(-)
> >
> > diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> > index 70a2f48..f2946a0 100644
> > --- a/arch/arm/mach-davinci/board-da850-evm.c
> > +++ b/arch/arm/mach-davinci/board-da850-evm.c
> > @@ -244,6 +244,20 @@ static void __init da850_evm_init_nor(void)
> >  	iounmap(aemif_addr);
> >  }
> >  
> > +#if defined(CONFIG_MTD_PHYSMAP) || \
> > +    defined(CONFIG_MTD_PHYSMAP_MODULE)
> > +#define HAS_NOR 1
> > +#else
> > +#define HAS_NOR 0
> > +#endif
> > +
> > +#if defined(CONFIG_MMC_DAVINCI) || \
> > +    defined(CONFIG_MMC_DAVINCI_MODULE)
> > +#define HAS_MMC 1
> > +#else
> > +#define HAS_MMC 0
> > +#endif
> > +
> >  static __init void da850_evm_init(void)
> >  {
> >  	struct davinci_soc_info *soc_info = &davinci_soc_info;
> > @@ -298,27 +312,34 @@ static __init void da850_evm_init(void)
> >  		pr_warning("da830_evm_init: watchdog registration failed: %d\n",
> >  				ret);
> >  
> > -	ret = da8xx_pinmux_setup(da850_mmcsd0_pins);
> > -	if (ret)
> > -		pr_warning("da850_evm_init: mmcsd0 mux setup failed: %d\n",
> > -				ret);
> > -
> > -	ret = gpio_request(DA850_MMCSD_CD_PIN, "MMC CD\n");
> > -	if (ret)
> > -		pr_warning("da850_evm_init: can not open GPIO %d\n",
> > -				DA850_MMCSD_CD_PIN);
> > -	gpio_direction_input(DA850_MMCSD_CD_PIN);
> > -
> > -	ret = gpio_request(DA850_MMCSD_WP_PIN, "MMC WP\n");
> > -	if (ret)
> > -		pr_warning("da850_evm_init: can not open GPIO %d\n",
> > -				DA850_MMCSD_WP_PIN);
> > -	gpio_direction_input(DA850_MMCSD_WP_PIN);
> > -
> > -	ret = da8xx_register_mmcsd0(&da850_mmc_config);
> > -	if (ret)
> > -		pr_warning("da850_evm_init: mmcsd0 registration failed: %d\n",
> > -				ret);
> > +	if (HAS_MMC) {
> > +		if (HAS_NOR)
> > +			pr_warning("WARNING: both NOR Flash and MMC/SD are "
> > +				"enabled, but they share AEMIF pins.\n"
> > +				"\tDisable one of them.\n");
> > +
> 
> Hmm, this isn't quite right.  MMC will never be configured unless NOR
> is enabled also.
>

This is not the case now. MMC will get initialized even if NOR is
not enabled. If the second if condition is true it only prints the
warning and proceeds to initialize MMC.

- Sudhakar
Kevin Hilman Aug. 14, 2009, 9:40 p.m. UTC | #3
"Sudhakar Rajashekhara" <sudhakar.raj@ti.com> writes:

> On Fri, Aug 14, 2009 at 04:51:05, Kevin Hilman wrote:
>> Sudhakar Rajashekhara <sudhakar.raj@ti.com> writes:
>> 
>> > On DA850/OMAP-L138 EVM, MMC/SD and NOR Flash share
>> > some of the AEMIF pins. This patch prints out a warning
>> > during booting, if both MMC/SD and NOR Flash are enabled
>> > in kernel menuconfig.
>> >
>> > If both MMC/SD and NOR Flash are enabled, only MMC/SD
>> > will work correctly.
>> >
>> > Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
>> > ---
>> >  This patch is dependent on the following patches which
>> >  I have submitted earlier:
>> >  [PATCH] davinci: Macro to convert GPIO signal to GPIO pin number
>> >  [PATCH v3] davinci: Add platform support for da850/omap-l138 GLCD
>> >  [PATCH v3] davinci: Add MMC/SD support for da850/omap-l138
>> >  [PATCH v3] davinci: Add NAND flash support for DA850/OMAP-L138
>> >  [PATCH v3] davinci: Add NOR flash support for da850/omap-l138 
>> 
>> FYI for future reference.  When you have lots of patch dependencies
>> like this, it is simpler to send them as a series.  If you use
>> git-format-patch for a range of commits, it will automatically do
>> the 'PATCH x/y' formatting etc.
>> 
>
> In this case, in the series if one patch needs modifications
> then do I need to re-submit the whole series again?

Usually, just resubmitting the changed patch is all that is needed,
unless of course it affects code changed by later patches.

[...]

>> > +	if (HAS_MMC) {
>> > +		if (HAS_NOR)
>> > +			pr_warning("WARNING: both NOR Flash and MMC/SD are "
>> > +				"enabled, but they share AEMIF pins.\n"
>> > +				"\tDisable one of them.\n");
>> > +
>> 
>> Hmm, this isn't quite right.  MMC will never be configured unless NOR
>> is enabled also.
>>
>
> This is not the case now. MMC will get initialized even if NOR is
> not enabled. If the second if condition is true it only prints the
> warning and proceeds to initialize MMC.

You're right, sorry for the noise. 

Pushed along with the others just now.

Kevin
diff mbox

Patch

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 70a2f48..f2946a0 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -244,6 +244,20 @@  static void __init da850_evm_init_nor(void)
 	iounmap(aemif_addr);
 }
 
+#if defined(CONFIG_MTD_PHYSMAP) || \
+    defined(CONFIG_MTD_PHYSMAP_MODULE)
+#define HAS_NOR 1
+#else
+#define HAS_NOR 0
+#endif
+
+#if defined(CONFIG_MMC_DAVINCI) || \
+    defined(CONFIG_MMC_DAVINCI_MODULE)
+#define HAS_MMC 1
+#else
+#define HAS_MMC 0
+#endif
+
 static __init void da850_evm_init(void)
 {
 	struct davinci_soc_info *soc_info = &davinci_soc_info;
@@ -298,27 +312,34 @@  static __init void da850_evm_init(void)
 		pr_warning("da830_evm_init: watchdog registration failed: %d\n",
 				ret);
 
-	ret = da8xx_pinmux_setup(da850_mmcsd0_pins);
-	if (ret)
-		pr_warning("da850_evm_init: mmcsd0 mux setup failed: %d\n",
-				ret);
-
-	ret = gpio_request(DA850_MMCSD_CD_PIN, "MMC CD\n");
-	if (ret)
-		pr_warning("da850_evm_init: can not open GPIO %d\n",
-				DA850_MMCSD_CD_PIN);
-	gpio_direction_input(DA850_MMCSD_CD_PIN);
-
-	ret = gpio_request(DA850_MMCSD_WP_PIN, "MMC WP\n");
-	if (ret)
-		pr_warning("da850_evm_init: can not open GPIO %d\n",
-				DA850_MMCSD_WP_PIN);
-	gpio_direction_input(DA850_MMCSD_WP_PIN);
-
-	ret = da8xx_register_mmcsd0(&da850_mmc_config);
-	if (ret)
-		pr_warning("da850_evm_init: mmcsd0 registration failed: %d\n",
-				ret);
+	if (HAS_MMC) {
+		if (HAS_NOR)
+			pr_warning("WARNING: both NOR Flash and MMC/SD are "
+				"enabled, but they share AEMIF pins.\n"
+				"\tDisable one of them.\n");
+
+		ret = da8xx_pinmux_setup(da850_mmcsd0_pins);
+		if (ret)
+			pr_warning("da850_evm_init: mmcsd0 mux setup failed:"
+					" %d\n", ret);
+
+		ret = gpio_request(DA850_MMCSD_CD_PIN, "MMC CD\n");
+		if (ret)
+			pr_warning("da850_evm_init: can not open GPIO %d\n",
+					DA850_MMCSD_CD_PIN);
+		gpio_direction_input(DA850_MMCSD_CD_PIN);
+
+		ret = gpio_request(DA850_MMCSD_WP_PIN, "MMC WP\n");
+		if (ret)
+			pr_warning("da850_evm_init: can not open GPIO %d\n",
+					DA850_MMCSD_WP_PIN);
+		gpio_direction_input(DA850_MMCSD_WP_PIN);
+
+		ret = da8xx_register_mmcsd0(&da850_mmc_config);
+		if (ret)
+			pr_warning("da850_evm_init: mmcsd0 registration failed:"
+					" %d\n", ret);
+	}
 
 	davinci_serial_init(&da850_evm_uart_config);