diff mbox

[v2] arm: mach-mmp: brownstone.c support multiple sd slots

Message ID 3BFCE791-3BAD-42ED-BC87-A27F40D6C77C@marvell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Philip Rakity April 28, 2011, 8:45 p.m. UTC
Support multiple sd/eMMC interfaces. enable mmc1, 2, and 3.
mmc2 is used eMMC and slot is marked PERMANENT and 8 bit device.
mmc1 is used for Wifi and slot is marked PERMANENT

Note: eMMC (mmc2) is set to initialize first to workaround a problem
where booting in logical order requires mmc create work queue
to be multi-threaded otherwise boot process hangs.  BUG report
send to linux-mmc and linux-kernel mailing list.

Wifi (mmc1) requires we enable power on the device by toggling
the gpio lines for power and reset.

Signed-off-by: Philip Rakity <prakity@marvell.com>
---
 arch/arm/mach-mmp/brownstone.c |   52 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 51 insertions(+), 1 deletions(-)

Comments

Eric Miao July 5, 2011, 6:52 a.m. UTC | #1
On Fri, Apr 29, 2011 at 4:45 AM, Philip Rakity <prakity@marvell.com> wrote:
>
> Support multiple sd/eMMC interfaces. enable mmc1, 2, and 3.
> mmc2 is used eMMC and slot is marked PERMANENT and 8 bit device.
> mmc1 is used for Wifi and slot is marked PERMANENT
>
> Note: eMMC (mmc2) is set to initialize first to workaround a problem
> where booting in logical order requires mmc create work queue
> to be multi-threaded otherwise boot process hangs.  BUG report
> send to linux-mmc and linux-kernel mailing list.
>
> Wifi (mmc1) requires we enable power on the device by toggling
> the gpio lines for power and reset.
>
> Signed-off-by: Philip Rakity <prakity@marvell.com>

Applied. Though the email client was fiddling the spaces/CR-LF a bit.

> ---
>  arch/arm/mach-mmp/brownstone.c |   52 +++++++++++++++++++++++++++++++++++++++-
>  1 files changed, 51 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-mmp/brownstone.c b/arch/arm/mach-mmp/brownstone.c
> index 7bb78fd..577e8de 100644
> --- a/arch/arm/mach-mmp/brownstone.c
> +++ b/arch/arm/mach-mmp/brownstone.c
> @@ -19,6 +19,7 @@
>  #include <linux/regulator/max8649.h>
>  #include <linux/regulator/fixed.h>
>  #include <linux/mfd/max8925.h>
> +#include <linux/delay.h>
>
>  #include <asm/mach-types.h>
>  #include <asm/mach/arch.h>
> @@ -177,9 +178,56 @@ static struct i2c_board_info brownstone_twsi1_info[] = {
>  };
>
>  static struct sdhci_pxa_platdata mmp2_sdh_platdata_mmc0 = {
> -       .max_speed      = 25000000,
> +       .adjust_clocks  = 1,
> +       .clk_select     = 1,
> +       .clk_delay      = 31,
>  };
>
> +static struct sdhci_pxa_platdata mmp2_sdh_platdata_mmc1 = {
> +       .adjust_clocks  = 1,
> +       .clk_select     = 1,
> +       .clk_delay      = 15,
> +       .flags          = PXA_FLAG_CARD_PERMANENT,
> +};
> +
> +static struct sdhci_pxa_platdata mmp2_sdh_platdata_mmc2 = {
> +       .adjust_clocks  = 1,
> +       .clk_select     = 1,
> +       .clk_delay      = 31,
> +       .flags          = PXA_FLAG_CARD_PERMANENT |
> +                               PXA_FLAG_SD_8_BIT_CAPABLE_SLOT,
> +};
> +
> +static void __init mmc_sdio_wifi(void)
> +{
> +       int poweron;
> +       int reset;
> +
> +       poweron = mfp_to_gpio(GPIO57_GPIO);
> +       reset = mfp_to_gpio(GPIO58_GPIO);
> +
> +       if (gpio_request(reset, "sd8xxx reset")) {
> +               printk(KERN_INFO "gpio %d request failed\n", reset);
> +               return;
> +       }
> +
> +       if (gpio_request(poweron, "sd8xxx PDn")) {
> +               gpio_free(reset);
> +               printk(KERN_INFO "gpio %d request failed\n", poweron);
> +               return;
> +       }
> +
> +       gpio_direction_output(poweron, 1);
> +       msleep(1);
> +       gpio_direction_output(reset, 0);
> +       msleep(1);
> +       gpio_direction_output(reset, 1);
> +       gpio_free(reset);
> +       gpio_free(poweron);
> +
> +       mmp2_add_sdhost(1, &mmp2_sdh_platdata_mmc1); /* Wifi */
> +}
> +
>  static void __init brownstone_init(void)
>  {
>        mfp_config(ARRAY_AND_SIZE(brownstone_pin_config));
> @@ -188,7 +236,9 @@ static void __init brownstone_init(void)
>        mmp2_add_uart(1);
>        mmp2_add_uart(3);
>        mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(brownstone_twsi1_info));
> +       mmp2_add_sdhost(2, &mmp2_sdh_platdata_mmc2); /* eMMC */
>        mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */
> +       mmc_sdio_wifi();
>
>        /* enable 5v regulator */
>        platform_device_register(&brownstone_v_5vp_device);
> --
> 1.7.0.4
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Zhangfei Gao July 5, 2011, 7:05 a.m. UTC | #2
On Tue, Jul 5, 2011 at 2:52 PM, Eric Miao <eric.y.miao@gmail.com> wrote:
> On Fri, Apr 29, 2011 at 4:45 AM, Philip Rakity <prakity@marvell.com> wrote:
>>
>> Support multiple sd/eMMC interfaces. enable mmc1, 2, and 3.
>> mmc2 is used eMMC and slot is marked PERMANENT and 8 bit device.
>> mmc1 is used for Wifi and slot is marked PERMANENT
>>
>> Note: eMMC (mmc2) is set to initialize first to workaround a problem
>> where booting in logical order requires mmc create work queue
>> to be multi-threaded otherwise boot process hangs.  BUG report
>> send to linux-mmc and linux-kernel mailing list.
>>
>> Wifi (mmc1) requires we enable power on the device by toggling
>> the gpio lines for power and reset.
>>
>> Signed-off-by: Philip Rakity <prakity@marvell.com>
>
> Applied. Though the email client was fiddling the spaces/CR-LF a bit.
>
>> ---
>>  arch/arm/mach-mmp/brownstone.c |   52 +++++++++++++++++++++++++++++++++++++++-
>>  1 files changed, 51 insertions(+), 1 deletions(-)
>>

Hi, Eric

arch/arm/mach-mmp/brownstone.c has already been modified from
mmc-next, here will have conflict.
Sorry for inconvenience.

Thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/mach-mmp/brownstone.c b/arch/arm/mach-mmp/brownstone.c
index 7bb78fd..577e8de 100644
--- a/arch/arm/mach-mmp/brownstone.c
+++ b/arch/arm/mach-mmp/brownstone.c
@@ -19,6 +19,7 @@ 
 #include <linux/regulator/max8649.h>
 #include <linux/regulator/fixed.h>
 #include <linux/mfd/max8925.h>
+#include <linux/delay.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -177,9 +178,56 @@  static struct i2c_board_info brownstone_twsi1_info[] = {
 };
 
 static struct sdhci_pxa_platdata mmp2_sdh_platdata_mmc0 = {
-	.max_speed	= 25000000,
+	.adjust_clocks	= 1,
+	.clk_select	= 1,
+	.clk_delay	= 31,
 };
 
+static struct sdhci_pxa_platdata mmp2_sdh_platdata_mmc1 = {
+	.adjust_clocks	= 1,
+	.clk_select	= 1,
+	.clk_delay	= 15,
+	.flags		= PXA_FLAG_CARD_PERMANENT,
+};
+
+static struct sdhci_pxa_platdata mmp2_sdh_platdata_mmc2 = {
+	.adjust_clocks	= 1,
+	.clk_select	= 1,
+	.clk_delay	= 31,
+	.flags		= PXA_FLAG_CARD_PERMANENT |
+				PXA_FLAG_SD_8_BIT_CAPABLE_SLOT,
+};
+
+static void __init mmc_sdio_wifi(void)
+{
+	int poweron;
+	int reset;
+
+	poweron = mfp_to_gpio(GPIO57_GPIO);
+	reset = mfp_to_gpio(GPIO58_GPIO);
+
+	if (gpio_request(reset, "sd8xxx reset")) {
+		printk(KERN_INFO "gpio %d request failed\n", reset);
+		return;
+	}
+
+	if (gpio_request(poweron, "sd8xxx PDn")) {
+		gpio_free(reset);
+		printk(KERN_INFO "gpio %d request failed\n", poweron);
+		return;
+	}
+
+	gpio_direction_output(poweron, 1);
+	msleep(1);
+	gpio_direction_output(reset, 0);
+	msleep(1);
+	gpio_direction_output(reset, 1);
+	gpio_free(reset);
+	gpio_free(poweron);
+
+	mmp2_add_sdhost(1, &mmp2_sdh_platdata_mmc1); /* Wifi */
+}
+
 static void __init brownstone_init(void)
 {
 	mfp_config(ARRAY_AND_SIZE(brownstone_pin_config));
@@ -188,7 +236,9 @@  static void __init brownstone_init(void)
 	mmp2_add_uart(1);
 	mmp2_add_uart(3);
 	mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(brownstone_twsi1_info));
+	mmp2_add_sdhost(2, &mmp2_sdh_platdata_mmc2); /* eMMC */
 	mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */
+	mmc_sdio_wifi();
 
 	/* enable 5v regulator */
 	platform_device_register(&brownstone_v_5vp_device);