All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 0/3] Enable MMC support for at91sam9x5ek board.
@ 2012-09-14  8:22 Josh Wu
  2012-09-14  8:22 ` [U-Boot] [PATCH v2 1/3] mmc: at91: add multi block read/write support Josh Wu
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Josh Wu @ 2012-09-14  8:22 UTC (permalink / raw)
  To: u-boot

This patch series enable MCI0 solt in at91sam9x5ek board.

Josh Wu (3):
  mmc: at91: add multi block read/write support.
  ARM: at91sam9x5: enable MCI0 support for 9x5ek board.
  mmc: at91: use max timeout value. It will avoid some situation that
    timeout happened.

 arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c |   15 +++++++++++++++
 board/atmel/at91sam9x5ek/at91sam9x5ek.c          |   10 ++++++++++
 drivers/mmc/gen_atmel_mci.c                      |   15 +++++++++++++--
 include/atmel_mci.h                              |    7 ++++++-
 include/configs/at91sam9x5ek.h                   |   10 ++++++++++
 5 files changed, 54 insertions(+), 3 deletions(-)

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH v2 1/3] mmc: at91: add multi block read/write support.
  2012-09-14  8:22 [U-Boot] [PATCH v2 0/3] Enable MMC support for at91sam9x5ek board Josh Wu
@ 2012-09-14  8:22 ` Josh Wu
  2012-10-17  9:38   ` Andreas Bießmann
  2012-09-14  8:22 ` [U-Boot] [PATCH v2 2/3] ARM: at91sam9x5: enable MCI0 support for 9x5ek board Josh Wu
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Josh Wu @ 2012-09-14  8:22 UTC (permalink / raw)
  To: u-boot

Since the at91sam9263, the mmc hardware support multi blocks read/write. So this driver enable it.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
---
since v1:
  use MMCI_BF macro and remove the redefinition for the BLKLEN according to Andreas' suggestion.

 drivers/mmc/gen_atmel_mci.c |   11 +++++++++++
 include/atmel_mci.h         |    7 ++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/gen_atmel_mci.c b/drivers/mmc/gen_atmel_mci.c
index 4968c5e..9f06304 100644
--- a/drivers/mmc/gen_atmel_mci.c
+++ b/drivers/mmc/gen_atmel_mci.c
@@ -87,6 +87,11 @@ static void mci_set_mode(struct mmc *mmc, u32 hz, u32 blklen)
 		 | MMCI_BF(BLKLEN, blklen)
 		 | MMCI_BIT(RDPROOF)
 		 | MMCI_BIT(WRPROOF)), &mci->mr);
+	/*
+	 * On some new platforms BLKLEN in mci->mr is ignored.
+	 * Should use the BLKLEN in the block register.
+	 */
+	writel(MMCI_BF(BLKLEN, blklen), &mci->blkr);
 	initialized = 1;
 }
 
@@ -183,6 +188,12 @@ mci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
 	/* Figure out the transfer arguments */
 	cmdr = mci_encode_cmd(cmd, data, &error_flags);
 
+	/* For multi blocks read/write, set the block register */
+	if ((cmd->cmdidx == MMC_CMD_READ_MULTIPLE_BLOCK)
+			|| (cmd->cmdidx == MMC_CMD_WRITE_MULTIPLE_BLOCK))
+		writel(data->blocks | MMCI_BF(BLKLEN, mmc->read_bl_len),
+			&mci->blkr);
+
 	/* Send the command */
 	writel(cmd->cmdarg, &mci->argr);
 	writel(cmdr, &mci->cmdr);
diff --git a/include/atmel_mci.h b/include/atmel_mci.h
index 3dd5d67..c711881 100644
--- a/include/atmel_mci.h
+++ b/include/atmel_mci.h
@@ -38,7 +38,7 @@ typedef struct atmel_mci {
 	u32	sdcr;	/* 0x0c */
 	u32	argr;	/* 0x10 */
 	u32	cmdr;	/* 0x14 */
-	u32	_18;	/* 0x18 */
+	u32	blkr;	/* 0x18 */
 	u32	_1c;	/* 0x1c */
 	u32	rspr;	/* 0x20 */
 	u32	rspr1;	/* 0x24 */
@@ -118,6 +118,11 @@ typedef struct atmel_mci {
 #define MMCI_TRTYP_OFFSET			19
 #define MMCI_TRTYP_SIZE				2
 
+/* Bitfields in BLKR */
+/* MMCI_BLKLEN_OFFSET/SIZE already defined in MR */
+#define MMCI_BCNT_OFFSET			0
+#define MMCI_BCNT_SIZE			16
+
 /* Bitfields in RSPRx */
 #define MMCI_RSP_OFFSET				0
 #define MMCI_RSP_SIZE				32
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH v2 2/3] ARM: at91sam9x5: enable MCI0 support for 9x5ek board.
  2012-09-14  8:22 [U-Boot] [PATCH v2 0/3] Enable MMC support for at91sam9x5ek board Josh Wu
  2012-09-14  8:22 ` [U-Boot] [PATCH v2 1/3] mmc: at91: add multi block read/write support Josh Wu
@ 2012-09-14  8:22 ` Josh Wu
  2012-10-17  9:39   ` Andreas Bießmann
  2012-09-14  8:22 ` [U-Boot] [PATCH v2 3/3] mmc: at91: use max timeout value. It will avoid some situation that timeout happened Josh Wu
  2012-10-09 10:11 ` [U-Boot] [PATCH v2 0/3] Enable MMC support for at91sam9x5ek board Josh Wu
  3 siblings, 1 reply; 10+ messages in thread
From: Josh Wu @ 2012-09-14  8:22 UTC (permalink / raw)
  To: u-boot


Signed-off-by: Josh Wu <josh.wu@atmel.com>
---
since v1:
  move the clock initialization function.
  remove useless #if macro block.

 arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c |   15 +++++++++++++++
 board/atmel/at91sam9x5ek/at91sam9x5ek.c          |   10 ++++++++++
 include/configs/at91sam9x5ek.h                   |   10 ++++++++++
 3 files changed, 35 insertions(+)

diff --git a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
index 6d77219..9348552 100644
--- a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
+++ b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
@@ -118,6 +118,21 @@ void at91_serial2_hw_init(void)
 	writel(1 << ATMEL_ID_USART2, &pmc->pcer);
 }
 
+void at91_mci_hw_init(void)
+{
+	/* Initialize the MCI0 */
+	at91_set_a_periph(AT91_PIO_PORTA, 17, 1);	/* MCCK */
+	at91_set_a_periph(AT91_PIO_PORTA, 16, 1);	/* MCCDA */
+	at91_set_a_periph(AT91_PIO_PORTA, 15, 1);	/* MCDA0 */
+	at91_set_a_periph(AT91_PIO_PORTA, 18, 1);	/* MCDA1 */
+	at91_set_a_periph(AT91_PIO_PORTA, 19, 1);	/* MCDA2 */
+	at91_set_a_periph(AT91_PIO_PORTA, 20, 1);	/* MCDA3 */
+
+	/* Enable clock for MCI0 */
+	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
+	writel(1 << ATMEL_ID_HSMCI0, &pmc->pcer);
+}
+
 #ifdef CONFIG_ATMEL_SPI
 void at91_spi0_hw_init(unsigned long cs_mask)
 {
diff --git a/board/atmel/at91sam9x5ek/at91sam9x5ek.c b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
index 06028aa..edb0886 100644
--- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c
+++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
@@ -31,6 +31,7 @@
 #include <asm/arch/clk.h>
 #include <lcd.h>
 #include <atmel_hlcdc.h>
+#include <atmel_mci.h>
 #ifdef CONFIG_MACB
 #include <net.h>
 #endif
@@ -258,6 +259,15 @@ void spi_cs_deactivate(struct spi_slave *slave)
 }
 #endif /* CONFIG_ATMEL_SPI */
 
+#ifdef CONFIG_GENERIC_ATMEL_MCI
+int board_mmc_init(bd_t *bd)
+{
+	at91_mci_hw_init();
+
+	return atmel_mci_init((void *)ATMEL_BASE_HSMCI0);
+}
+#endif
+
 int board_early_init_f(void)
 {
 	at91_seriald_hw_init();
diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h
index 1ceb31a..9e1942d 100644
--- a/include/configs/at91sam9x5ek.h
+++ b/include/configs/at91sam9x5ek.h
@@ -87,6 +87,7 @@
 #define CONFIG_CMD_DHCP
 #define CONFIG_CMD_NAND
 #define CONFIG_CMD_SF
+#define CONFIG_CMD_MMC
 
 /* SDRAM */
 #define CONFIG_NR_DRAM_BANKS		1
@@ -136,6 +137,15 @@
 #define CONFIG_CMD_UBIFS
 #endif
 
+/* MMC */
+#ifdef CONFIG_CMD_MMC
+#define CONFIG_MMC
+#define CONFIG_CMD_FAT
+#define CONFIG_GENERIC_MMC
+#define CONFIG_GENERIC_ATMEL_MCI
+#define CONFIG_DOS_PARTITION
+#endif
+
 /* Ethernet */
 #define CONFIG_MACB
 #define CONFIG_RMII
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH v2 3/3] mmc: at91: use max timeout value. It will avoid some situation that timeout happened.
  2012-09-14  8:22 [U-Boot] [PATCH v2 0/3] Enable MMC support for at91sam9x5ek board Josh Wu
  2012-09-14  8:22 ` [U-Boot] [PATCH v2 1/3] mmc: at91: add multi block read/write support Josh Wu
  2012-09-14  8:22 ` [U-Boot] [PATCH v2 2/3] ARM: at91sam9x5: enable MCI0 support for 9x5ek board Josh Wu
@ 2012-09-14  8:22 ` Josh Wu
  2012-10-17  9:39   ` Andreas Bießmann
  2012-10-09 10:11 ` [U-Boot] [PATCH v2 0/3] Enable MMC support for at91sam9x5ek board Josh Wu
  3 siblings, 1 reply; 10+ messages in thread
From: Josh Wu @ 2012-09-14  8:22 UTC (permalink / raw)
  To: u-boot


Signed-off-by: Josh Wu <josh.wu@atmel.com>
---
since v1:
  seperate it as one patch from v1.

 drivers/mmc/gen_atmel_mci.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/gen_atmel_mci.c b/drivers/mmc/gen_atmel_mci.c
index 9f06304..67b2dbe 100644
--- a/drivers/mmc/gen_atmel_mci.c
+++ b/drivers/mmc/gen_atmel_mci.c
@@ -321,8 +321,8 @@ static int mci_init(struct mmc *mmc)
 	writel(MMCI_BIT(MCIEN), &mci->cr);	/* enable mci */
 	writel(MMCI_BF(SCDSEL, MCI_BUS), &mci->sdcr);	/* select port */
 
-	/* Initial Time-outs */
-	writel(0x5f, &mci->dtor);
+	/* This delay can be optimized, but stick with max value */
+	writel(0x7f, &mci->dtor);
 	/* Disable Interrupts */
 	writel(~0UL, &mci->idr);
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH v2 0/3] Enable MMC support for at91sam9x5ek board.
  2012-09-14  8:22 [U-Boot] [PATCH v2 0/3] Enable MMC support for at91sam9x5ek board Josh Wu
                   ` (2 preceding siblings ...)
  2012-09-14  8:22 ` [U-Boot] [PATCH v2 3/3] mmc: at91: use max timeout value. It will avoid some situation that timeout happened Josh Wu
@ 2012-10-09 10:11 ` Josh Wu
  2012-10-09 21:51   ` Andreas Bießmann
  3 siblings, 1 reply; 10+ messages in thread
From: Josh Wu @ 2012-10-09 10:11 UTC (permalink / raw)
  To: u-boot

Hi, Andreas

Any feedback of these patches?

Best Regards,
Josh Wu

On 9/14/2012 4:22 PM, Josh Wu wrote:
> This patch series enable MCI0 solt in at91sam9x5ek board.
>
> Josh Wu (3):
>    mmc: at91: add multi block read/write support.
>    ARM: at91sam9x5: enable MCI0 support for 9x5ek board.
>    mmc: at91: use max timeout value. It will avoid some situation that
>      timeout happened.
>
>   arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c |   15 +++++++++++++++
>   board/atmel/at91sam9x5ek/at91sam9x5ek.c          |   10 ++++++++++
>   drivers/mmc/gen_atmel_mci.c                      |   15 +++++++++++++--
>   include/atmel_mci.h                              |    7 ++++++-
>   include/configs/at91sam9x5ek.h                   |   10 ++++++++++
>   5 files changed, 54 insertions(+), 3 deletions(-)
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH v2 0/3] Enable MMC support for at91sam9x5ek board.
  2012-10-09 10:11 ` [U-Boot] [PATCH v2 0/3] Enable MMC support for at91sam9x5ek board Josh Wu
@ 2012-10-09 21:51   ` Andreas Bießmann
  2012-10-10  1:42     ` Josh Wu
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Bießmann @ 2012-10-09 21:51 UTC (permalink / raw)
  To: u-boot

Hi Josh,

On 09.10.12 12:11, Josh Wu wrote:
> Hi, Andreas
> 
> Any feedback of these patches?

short answer: no ;)

I think they could go into next (no obvious objections), but I would
like to do some runtime tests on avr32 before. Beside that, if you do
not insist on applying them ASAP to next I would like to wait until the
release next Monday and apply the patches to u-boot-atmel/master then.
Is that OK for you?

Best regards

Andreas Bie?mann

> 
> Best Regards,
> Josh Wu
> 
> On 9/14/2012 4:22 PM, Josh Wu wrote:
>> This patch series enable MCI0 solt in at91sam9x5ek board.
>>
>> Josh Wu (3):
>>    mmc: at91: add multi block read/write support.
>>    ARM: at91sam9x5: enable MCI0 support for 9x5ek board.
>>    mmc: at91: use max timeout value. It will avoid some situation that
>>      timeout happened.
>>
>>   arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c |   15 +++++++++++++++
>>   board/atmel/at91sam9x5ek/at91sam9x5ek.c          |   10 ++++++++++
>>   drivers/mmc/gen_atmel_mci.c                      |   15 +++++++++++++--
>>   include/atmel_mci.h                              |    7 ++++++-
>>   include/configs/at91sam9x5ek.h                   |   10 ++++++++++
>>   5 files changed, 54 insertions(+), 3 deletions(-)
>>
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH v2 0/3] Enable MMC support for at91sam9x5ek board.
  2012-10-09 21:51   ` Andreas Bießmann
@ 2012-10-10  1:42     ` Josh Wu
  0 siblings, 0 replies; 10+ messages in thread
From: Josh Wu @ 2012-10-10  1:42 UTC (permalink / raw)
  To: u-boot

Hi, Andreas

On 10/10/2012 5:51 AM, Andreas Bie?mann wrote:
> Hi Josh,
>
> On 09.10.12 12:11, Josh Wu wrote:
>> Hi, Andreas
>>
>> Any feedback of these patches?
> short answer: no ;)
>
> I think they could go into next (no obvious objections), but I would
> like to do some runtime tests on avr32 before. Beside that, if you do
> not insist on applying them ASAP to next I would like to wait until the
> release next Monday and apply the patches to u-boot-atmel/master then.
> Is that OK for you?

Yes, I'm fine with this. thank you.

Best Regards,
Josh Wu

>
> Best regards
>
> Andreas Bie?mann
>
>> Best Regards,
>> Josh Wu
>>
>> On 9/14/2012 4:22 PM, Josh Wu wrote:
>>> This patch series enable MCI0 solt in at91sam9x5ek board.
>>>
>>> Josh Wu (3):
>>>     mmc: at91: add multi block read/write support.
>>>     ARM: at91sam9x5: enable MCI0 support for 9x5ek board.
>>>     mmc: at91: use max timeout value. It will avoid some situation that
>>>       timeout happened.
>>>
>>>    arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c |   15 +++++++++++++++
>>>    board/atmel/at91sam9x5ek/at91sam9x5ek.c          |   10 ++++++++++
>>>    drivers/mmc/gen_atmel_mci.c                      |   15 +++++++++++++--
>>>    include/atmel_mci.h                              |    7 ++++++-
>>>    include/configs/at91sam9x5ek.h                   |   10 ++++++++++
>>>    5 files changed, 54 insertions(+), 3 deletions(-)
>>>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH v2 1/3] mmc: at91: add multi block read/write support.
  2012-09-14  8:22 ` [U-Boot] [PATCH v2 1/3] mmc: at91: add multi block read/write support Josh Wu
@ 2012-10-17  9:38   ` Andreas Bießmann
  0 siblings, 0 replies; 10+ messages in thread
From: Andreas Bießmann @ 2012-10-17  9:38 UTC (permalink / raw)
  To: u-boot

Dear Josh Wu,

On 14.09.2012 10:22, Josh Wu wrote:
> Since the at91sam9263, the mmc hardware support multi blocks read/write. So this driver enable it.
> 
> Signed-off-by: Josh Wu <josh.wu@atmel.com>
> ---
> since v1:
>   use MMCI_BF macro and remove the redefinition for the BLKLEN according to Andreas' suggestion.

applied to u-boot-atmel/master, thanks!

BTW: this also fixes avr32 multi block access, great work!

Best regards

Andreas Bie?mann

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH v2 2/3] ARM: at91sam9x5: enable MCI0 support for 9x5ek board.
  2012-09-14  8:22 ` [U-Boot] [PATCH v2 2/3] ARM: at91sam9x5: enable MCI0 support for 9x5ek board Josh Wu
@ 2012-10-17  9:39   ` Andreas Bießmann
  0 siblings, 0 replies; 10+ messages in thread
From: Andreas Bießmann @ 2012-10-17  9:39 UTC (permalink / raw)
  To: u-boot

Dear Josh Wu,

On 14.09.2012 10:22, Josh Wu wrote:
> Signed-off-by: Josh Wu <josh.wu@atmel.com>
> ---
> since v1:
>   move the clock initialization function.
>   remove useless #if macro block.
> 
>  arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c |   15 +++++++++++++++
>  board/atmel/at91sam9x5ek/at91sam9x5ek.c          |   10 ++++++++++
>  include/configs/at91sam9x5ek.h                   |   10 ++++++++++
>  3 files changed, 35 insertions(+)

applied to u-boot-atmel/master, thanks!

Best regards

Andreas Bie?mann

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH v2 3/3] mmc: at91: use max timeout value. It will avoid some situation that timeout happened.
  2012-09-14  8:22 ` [U-Boot] [PATCH v2 3/3] mmc: at91: use max timeout value. It will avoid some situation that timeout happened Josh Wu
@ 2012-10-17  9:39   ` Andreas Bießmann
  0 siblings, 0 replies; 10+ messages in thread
From: Andreas Bießmann @ 2012-10-17  9:39 UTC (permalink / raw)
  To: u-boot

Dear Josh Wu,

On 14.09.2012 10:22, Josh Wu wrote:
> Signed-off-by: Josh Wu <josh.wu@atmel.com>
> ---
> since v1:
>   seperate it as one patch from v1.
> 
>  drivers/mmc/gen_atmel_mci.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

applied to u-boot-atmel/master, thanks!

Best regards

Andreas Bie?mann

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-10-17  9:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-14  8:22 [U-Boot] [PATCH v2 0/3] Enable MMC support for at91sam9x5ek board Josh Wu
2012-09-14  8:22 ` [U-Boot] [PATCH v2 1/3] mmc: at91: add multi block read/write support Josh Wu
2012-10-17  9:38   ` Andreas Bießmann
2012-09-14  8:22 ` [U-Boot] [PATCH v2 2/3] ARM: at91sam9x5: enable MCI0 support for 9x5ek board Josh Wu
2012-10-17  9:39   ` Andreas Bießmann
2012-09-14  8:22 ` [U-Boot] [PATCH v2 3/3] mmc: at91: use max timeout value. It will avoid some situation that timeout happened Josh Wu
2012-10-17  9:39   ` Andreas Bießmann
2012-10-09 10:11 ` [U-Boot] [PATCH v2 0/3] Enable MMC support for at91sam9x5ek board Josh Wu
2012-10-09 21:51   ` Andreas Bießmann
2012-10-10  1:42     ` Josh Wu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.