Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH] mmc: add include <linux/mmc/mmc.h> to au1xmmc.c
@ 2007-05-11  3:59 Yoichi Yuasa
  2007-05-11  4:47 ` Pierre Ossman
  0 siblings, 1 reply; 8+ messages in thread
From: Yoichi Yuasa @ 2007-05-11  3:59 UTC (permalink / raw)
  To: drzeus; +Cc: yoichi_yuasa, linux-mips

Hi,

This patch has fixed the following error about au1xmmc.c .

drivers/mmc/host/au1xmmc.c: In function 'au1xmmc_send_command':
drivers/mmc/host/au1xmmc.c:217: error: 'MMC_READ_SINGLE_BLOCK' undeclared (first use in this function)
drivers/mmc/host/au1xmmc.c:217: error: (Each undeclared identifier is reported only once
drivers/mmc/host/au1xmmc.c:217: error: for each function it appears in.)
drivers/mmc/host/au1xmmc.c:218: error: 'SD_APP_SEND_SCR' undeclared (first use in this function)
drivers/mmc/host/au1xmmc.c:221: error: 'MMC_READ_MULTIPLE_BLOCK' undeclared (first use in this function)
drivers/mmc/host/au1xmmc.c:224: error: 'MMC_WRITE_BLOCK' undeclared (first use in this function)
drivers/mmc/host/au1xmmc.c:228: error: 'MMC_WRITE_MULTIPLE_BLOCK' undeclared (first use in this function)
drivers/mmc/host/au1xmmc.c:231: error: 'MMC_STOP_TRANSMISSION' undeclared (first use in this function)

Yoichi

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>

diff -pruN -X mips/Documentation/dontdiff mips-orig/drivers/mmc/host/au1xmmc.c mips/drivers/mmc/host/au1xmmc.c
--- mips-orig/drivers/mmc/host/au1xmmc.c	2007-05-10 15:14:44.705610250 +0900
+++ mips/drivers/mmc/host/au1xmmc.c	2007-05-10 18:12:02.785248000 +0900
@@ -42,6 +42,7 @@
 #include <linux/dma-mapping.h>
 
 #include <linux/mmc/host.h>
+#include <linux/mmc/mmc.h>
 #include <asm/io.h>
 #include <asm/mach-au1x00/au1000.h>
 #include <asm/mach-au1x00/au1xxx_dbdma.h>

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

* Re: [PATCH] mmc: add include <linux/mmc/mmc.h> to au1xmmc.c
  2007-05-11  3:59 [PATCH] mmc: add include <linux/mmc/mmc.h> to au1xmmc.c Yoichi Yuasa
@ 2007-05-11  4:47 ` Pierre Ossman
  2007-05-11  5:16   ` Yoichi Yuasa
  0 siblings, 1 reply; 8+ messages in thread
From: Pierre Ossman @ 2007-05-11  4:47 UTC (permalink / raw)
  To: Yoichi Yuasa; +Cc: linux-mips

[-- Attachment #1: Type: text/plain, Size: 1150 bytes --]

Yoichi Yuasa wrote:
> Hi,
> 
> This patch has fixed the following error about au1xmmc.c .
> 
> drivers/mmc/host/au1xmmc.c: In function 'au1xmmc_send_command':
> drivers/mmc/host/au1xmmc.c:217: error: 'MMC_READ_SINGLE_BLOCK' undeclared (first use in this function)
> drivers/mmc/host/au1xmmc.c:217: error: (Each undeclared identifier is reported only once
> drivers/mmc/host/au1xmmc.c:217: error: for each function it appears in.)
> drivers/mmc/host/au1xmmc.c:218: error: 'SD_APP_SEND_SCR' undeclared (first use in this function)
> drivers/mmc/host/au1xmmc.c:221: error: 'MMC_READ_MULTIPLE_BLOCK' undeclared (first use in this function)
> drivers/mmc/host/au1xmmc.c:224: error: 'MMC_WRITE_BLOCK' undeclared (first use in this function)
> drivers/mmc/host/au1xmmc.c:228: error: 'MMC_WRITE_MULTIPLE_BLOCK' undeclared (first use in this function)
> drivers/mmc/host/au1xmmc.c:231: error: 'MMC_STOP_TRANSMISSION' undeclared (first use in this function)
> 
> Yoichi
> 
> Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
> 

NAK for now. I want an explanation what those opcodes are doing in a host driver.

Rgds
Pierre



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

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

* Re: [PATCH] mmc: add include <linux/mmc/mmc.h> to au1xmmc.c
  2007-05-11  4:47 ` Pierre Ossman
@ 2007-05-11  5:16   ` Yoichi Yuasa
  2007-05-11  5:20     ` Pierre Ossman
  0 siblings, 1 reply; 8+ messages in thread
From: Yoichi Yuasa @ 2007-05-11  5:16 UTC (permalink / raw)
  To: Pierre Ossman; +Cc: yoichi_yuasa, linux-mips

Hi,

On Fri, 11 May 2007 06:47:56 +0200
Pierre Ossman <drzeus@drzeus.cx> wrote:

> Yoichi Yuasa wrote:
> > Hi,
> > 
> > This patch has fixed the following error about au1xmmc.c .
> > 
> > drivers/mmc/host/au1xmmc.c: In function 'au1xmmc_send_command':
> > drivers/mmc/host/au1xmmc.c:217: error: 'MMC_READ_SINGLE_BLOCK' undeclared (first use in this function)
> > drivers/mmc/host/au1xmmc.c:217: error: (Each undeclared identifier is reported only once
> > drivers/mmc/host/au1xmmc.c:217: error: for each function it appears in.)
> > drivers/mmc/host/au1xmmc.c:218: error: 'SD_APP_SEND_SCR' undeclared (first use in this function)
> > drivers/mmc/host/au1xmmc.c:221: error: 'MMC_READ_MULTIPLE_BLOCK' undeclared (first use in this function)
> > drivers/mmc/host/au1xmmc.c:224: error: 'MMC_WRITE_BLOCK' undeclared (first use in this function)
> > drivers/mmc/host/au1xmmc.c:228: error: 'MMC_WRITE_MULTIPLE_BLOCK' undeclared (first use in this function)
> > drivers/mmc/host/au1xmmc.c:231: error: 'MMC_STOP_TRANSMISSION' undeclared (first use in this function)
> > 
> > Yoichi
> > 
> > Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
> > 
> 
> NAK for now. I want an explanation what those opcodes are doing in a host driver.

The commands of au1xmmc controller are different from standard commands. 
au1xmmc_send_command() convert standard commands to local commands for au1xmmc host controller,
and send local commands to controller.

Yoichi

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

* Re: [PATCH] mmc: add include <linux/mmc/mmc.h> to au1xmmc.c
  2007-05-11  5:16   ` Yoichi Yuasa
@ 2007-05-11  5:20     ` Pierre Ossman
  2007-05-11 10:29       ` [PATCH] mmc: au1xmmc command types check from data flags Yoichi Yuasa
  0 siblings, 1 reply; 8+ messages in thread
From: Pierre Ossman @ 2007-05-11  5:20 UTC (permalink / raw)
  To: Yoichi Yuasa; +Cc: linux-mips

[-- Attachment #1: Type: text/plain, Size: 416 bytes --]

Yoichi Yuasa wrote:
> 
> The commands of au1xmmc controller are different from standard commands. 
> au1xmmc_send_command() convert standard commands to local commands for au1xmmc host controller,
> and send local commands to controller.
> 

A quick glance at the code seems to suggest it's specifying the type of command.
And it should be able to figure that out in a more generic way.

Rgds
Pierre



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

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

* [PATCH] mmc: au1xmmc command types check from data flags
  2007-05-11  5:20     ` Pierre Ossman
@ 2007-05-11 10:29       ` Yoichi Yuasa
  2007-05-11 11:07         ` Manuel Lauss
  2007-05-11 15:48         ` Pierre Ossman
  0 siblings, 2 replies; 8+ messages in thread
From: Yoichi Yuasa @ 2007-05-11 10:29 UTC (permalink / raw)
  To: Pierre Ossman; +Cc: yoichi_yuasa, linux-mips

On Fri, 11 May 2007 07:20:43 +0200
Pierre Ossman <drzeus@drzeus.cx> wrote:

> Yoichi Yuasa wrote:
> > 
> > The commands of au1xmmc controller are different from standard commands. 
> > au1xmmc_send_command() convert standard commands to local commands for au1xmmc host controller,
> > and send local commands to controller.
> > 
> 
> A quick glance at the code seems to suggest it's specifying the type of command.
> And it should be able to figure that out in a more generic way.

Ok, I updated the patch for au1xmmc.c .

This patch has changed command types check from data flags.

MMC_STOP_TRANSMISSION is never passed to au1xmmc_send_command().
SEND_STOP() is used for MMC_STOP_TRANSMISSION.

Yoichi

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>

diff -pruN -X mips/Documentation/dontdiff mips-orig/drivers/mmc/host/au1xmmc.c mips/drivers/mmc/host/au1xmmc.c
--- mips-orig/drivers/mmc/host/au1xmmc.c	2007-05-11 10:27:01.068483750 +0900
+++ mips/drivers/mmc/host/au1xmmc.c	2007-05-11 19:13:11.426283750 +0900
@@ -189,7 +189,7 @@ static void au1xmmc_tasklet_finish(unsig
 static int au1xmmc_send_command(struct au1xmmc_host *host, int wait,
 				struct mmc_command *cmd)
 {
-
+	unsigned int flags;
 	u32 mmccmd = (cmd->opcode << SD_CMD_CI_SHIFT);
 
 	switch (mmc_resp_type(cmd)) {
@@ -213,24 +213,17 @@ static int au1xmmc_send_command(struct a
 		return MMC_ERR_INVALID;
 	}
 
-	switch(cmd->opcode) {
-	case MMC_READ_SINGLE_BLOCK:
-	case SD_APP_SEND_SCR:
-		mmccmd |= SD_CMD_CT_2;
-		break;
-	case MMC_READ_MULTIPLE_BLOCK:
-		mmccmd |= SD_CMD_CT_4;
-		break;
-	case MMC_WRITE_BLOCK:
-		mmccmd |= SD_CMD_CT_1;
-		break;
-
-	case MMC_WRITE_MULTIPLE_BLOCK:
-		mmccmd |= SD_CMD_CT_3;
-		break;
-	case MMC_STOP_TRANSMISSION:
-		mmccmd |= SD_CMD_CT_7;
-		break;
+	flags = cmd->data->flags;
+	if (flags & MMC_DATA_READ) {
+		if (flags & MMC_DATA_MULTI)
+			mmccmd |= SD_CMD_CT_4;
+		else
+			mmccmd |= SD_CMD_CT_2;
+	} else if (flags & MMC_DATA_WRITE) {
+		if (flags & MMC_DATA_MULTI)
+			mmccmd |= SD_CMD_CT_3;
+		else
+			mmccmd |= SD_CMD_CT_1;
 	}
 
 	au_writel(cmd->arg, HOST_CMDARG(host));

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

* Re: [PATCH] mmc: au1xmmc command types check from data flags
  2007-05-11 10:29       ` [PATCH] mmc: au1xmmc command types check from data flags Yoichi Yuasa
@ 2007-05-11 11:07         ` Manuel Lauss
  2007-05-11 11:27           ` Yoichi Yuasa
  2007-05-11 15:48         ` Pierre Ossman
  1 sibling, 1 reply; 8+ messages in thread
From: Manuel Lauss @ 2007-05-11 11:07 UTC (permalink / raw)
  To: Yoichi Yuasa; +Cc: Pierre Ossman, linux-mips

Hi Yoichi,

> --- mips-orig/drivers/mmc/host/au1xmmc.c	2007-05-11 10:27:01.068483750 +0900
> +++ mips/drivers/mmc/host/au1xmmc.c	2007-05-11 19:13:11.426283750 +0900
> @@ -189,7 +189,7 @@ static void au1xmmc_tasklet_finish(unsig
> @@ -213,24 +213,17 @@ static int au1xmmc_send_command(struct a
>  		return MMC_ERR_INVALID;
>  	}
>  
> -	switch(cmd->opcode) {
> -	case MMC_READ_SINGLE_BLOCK:
> -	case SD_APP_SEND_SCR:
> -		mmccmd |= SD_CMD_CT_2;
> -		break;
> -	case MMC_READ_MULTIPLE_BLOCK:
> -		mmccmd |= SD_CMD_CT_4;
> -		break;
> -	case MMC_WRITE_BLOCK:
> -		mmccmd |= SD_CMD_CT_1;
> -		break;
> -
> -	case MMC_WRITE_MULTIPLE_BLOCK:
> -		mmccmd |= SD_CMD_CT_3;
> -		break;
> -	case MMC_STOP_TRANSMISSION:
> -		mmccmd |= SD_CMD_CT_7;
> -		break;
> +	flags = cmd->data->flags;
		^^^^^^^^
This line oopses the driver on my Au1200
->data can be NULL

> +	if (flags & MMC_DATA_READ) {
> +		if (flags & MMC_DATA_MULTI)
> +			mmccmd |= SD_CMD_CT_4;
> +		else
> +			mmccmd |= SD_CMD_CT_2;
> +	} else if (flags & MMC_DATA_WRITE) {
> +		if (flags & MMC_DATA_MULTI)
> +			mmccmd |= SD_CMD_CT_3;
> +		else
> +			mmccmd |= SD_CMD_CT_1;
>  	}

what about SD_CMD_CT_7?

Hows this:

	if (cmd->data)
		flags = cmd->data->flags;
	else if (cmd->opcode == 12)
		mmccmd |= CD_SMD_CT_7;
	else
		flags = 0;

	if (flags & MMC_DATA_READ) {
	[...]
 
>  	au_writel(cmd->arg, HOST_CMDARG(host));
> 

Thanks,
	Manuel Lauss

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

* Re: [PATCH] mmc: au1xmmc command types check from data flags
  2007-05-11 11:07         ` Manuel Lauss
@ 2007-05-11 11:27           ` Yoichi Yuasa
  0 siblings, 0 replies; 8+ messages in thread
From: Yoichi Yuasa @ 2007-05-11 11:27 UTC (permalink / raw)
  To: Manuel Lauss; +Cc: yoichi_yuasa, drzeus, linux-mips

Hi,

On Fri, 11 May 2007 13:07:02 +0200
Manuel Lauss <mano@roarinelk.homelinux.net> wrote:

> Hi Yoichi,
> 
> > --- mips-orig/drivers/mmc/host/au1xmmc.c	2007-05-11 10:27:01.068483750 +0900
> > +++ mips/drivers/mmc/host/au1xmmc.c	2007-05-11 19:13:11.426283750 +0900
> > @@ -189,7 +189,7 @@ static void au1xmmc_tasklet_finish(unsig
> > @@ -213,24 +213,17 @@ static int au1xmmc_send_command(struct a
> >  		return MMC_ERR_INVALID;
> >  	}
> >  
> > -	switch(cmd->opcode) {
> > -	case MMC_READ_SINGLE_BLOCK:
> > -	case SD_APP_SEND_SCR:
> > -		mmccmd |= SD_CMD_CT_2;
> > -		break;
> > -	case MMC_READ_MULTIPLE_BLOCK:
> > -		mmccmd |= SD_CMD_CT_4;
> > -		break;
> > -	case MMC_WRITE_BLOCK:
> > -		mmccmd |= SD_CMD_CT_1;
> > -		break;
> > -
> > -	case MMC_WRITE_MULTIPLE_BLOCK:
> > -		mmccmd |= SD_CMD_CT_3;
> > -		break;
> > -	case MMC_STOP_TRANSMISSION:
> > -		mmccmd |= SD_CMD_CT_7;
> > -		break;
> > +	flags = cmd->data->flags;
> 		^^^^^^^^
> This line oopses the driver on my Au1200
> ->data can be NULL

Thank you testing the patch.

I don't have a db1200.
Please test new one.

> 
> > +	if (flags & MMC_DATA_READ) {
> > +		if (flags & MMC_DATA_MULTI)
> > +			mmccmd |= SD_CMD_CT_4;
> > +		else
> > +			mmccmd |= SD_CMD_CT_2;
> > +	} else if (flags & MMC_DATA_WRITE) {
> > +		if (flags & MMC_DATA_MULTI)
> > +			mmccmd |= SD_CMD_CT_3;
> > +		else
> > +			mmccmd |= SD_CMD_CT_1;
> >  	}
> 
> what about SD_CMD_CT_7?

MMC_STOP_TRANSMISSION is never passed to au1xmmc_send_command().
We don't need to care SD_CMD_CT_7 here.

Yoichi

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>

diff -pruN -X mips/Documentation/dontdiff mips-orig/drivers/mmc/host/au1xmmc.c mips/drivers/mmc/host/au1xmmc.c
--- mips-orig/drivers/mmc/host/au1xmmc.c	2007-05-11 20:15:50.358847000 +0900
+++ mips/drivers/mmc/host/au1xmmc.c	2007-05-11 20:20:36.804748750 +0900
@@ -187,9 +187,8 @@ static void au1xmmc_tasklet_finish(unsig
 }
 
 static int au1xmmc_send_command(struct au1xmmc_host *host, int wait,
-				struct mmc_command *cmd)
+				struct mmc_command *cmd, unsigned int flags)
 {
-
 	u32 mmccmd = (cmd->opcode << SD_CMD_CI_SHIFT);
 
 	switch (mmc_resp_type(cmd)) {
@@ -213,24 +212,16 @@ static int au1xmmc_send_command(struct a
 		return MMC_ERR_INVALID;
 	}
 
-	switch(cmd->opcode) {
-	case MMC_READ_SINGLE_BLOCK:
-	case SD_APP_SEND_SCR:
-		mmccmd |= SD_CMD_CT_2;
-		break;
-	case MMC_READ_MULTIPLE_BLOCK:
-		mmccmd |= SD_CMD_CT_4;
-		break;
-	case MMC_WRITE_BLOCK:
-		mmccmd |= SD_CMD_CT_1;
-		break;
-
-	case MMC_WRITE_MULTIPLE_BLOCK:
-		mmccmd |= SD_CMD_CT_3;
-		break;
-	case MMC_STOP_TRANSMISSION:
-		mmccmd |= SD_CMD_CT_7;
-		break;
+	if (flags & MMC_DATA_READ) {
+		if (flags & MMC_DATA_MULTI)
+			mmccmd |= SD_CMD_CT_4;
+		else
+			mmccmd |= SD_CMD_CT_2;
+	} else if (flags & MMC_DATA_WRITE) {
+		if (flags & MMC_DATA_MULTI)
+			mmccmd |= SD_CMD_CT_3;
+		else
+			mmccmd |= SD_CMD_CT_1;
 	}
 
 	au_writel(cmd->arg, HOST_CMDARG(host));
@@ -665,6 +656,7 @@ static void au1xmmc_request(struct mmc_h
 {
 
 	struct au1xmmc_host *host = mmc_priv(mmc);
+	unsigned int flags = 0;
 	int ret = MMC_ERR_NONE;
 
 	WARN_ON(irqs_disabled());
@@ -677,11 +669,12 @@ static void au1xmmc_request(struct mmc_h
 
 	if (mrq->data) {
 		FLUSH_FIFO(host);
+		flags = mrq->data->flags;
 		ret = au1xmmc_prepare_data(host, mrq->data);
 	}
 
 	if (ret == MMC_ERR_NONE)
-		ret = au1xmmc_send_command(host, 0, mrq->cmd);
+		ret = au1xmmc_send_command(host, 0, mrq->cmd, flags);
 
 	if (ret != MMC_ERR_NONE) {
 		mrq->cmd->error = ret;

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

* Re: [PATCH] mmc: au1xmmc command types check from data flags
  2007-05-11 10:29       ` [PATCH] mmc: au1xmmc command types check from data flags Yoichi Yuasa
  2007-05-11 11:07         ` Manuel Lauss
@ 2007-05-11 15:48         ` Pierre Ossman
  1 sibling, 0 replies; 8+ messages in thread
From: Pierre Ossman @ 2007-05-11 15:48 UTC (permalink / raw)
  To: Yoichi Yuasa; +Cc: linux-mips

[-- Attachment #1: Type: text/plain, Size: 478 bytes --]

Yoichi Yuasa wrote:
> 
> Ok, I updated the patch for au1xmmc.c .
> 
> This patch has changed command types check from data flags.
> 

Perfect. That's just the way things should be.

> MMC_STOP_TRANSMISSION is never passed to au1xmmc_send_command().
> SEND_STOP() is used for MMC_STOP_TRANSMISSION.
> 

That SEND_STOP however is a long standing bug in this driver. Could I bother you
with fixing the driver so that it respects mrq->data->stop?

Rgds
Pierre



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

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

end of thread, other threads:[~2007-05-11 15:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-11  3:59 [PATCH] mmc: add include <linux/mmc/mmc.h> to au1xmmc.c Yoichi Yuasa
2007-05-11  4:47 ` Pierre Ossman
2007-05-11  5:16   ` Yoichi Yuasa
2007-05-11  5:20     ` Pierre Ossman
2007-05-11 10:29       ` [PATCH] mmc: au1xmmc command types check from data flags Yoichi Yuasa
2007-05-11 11:07         ` Manuel Lauss
2007-05-11 11:27           ` Yoichi Yuasa
2007-05-11 15:48         ` Pierre Ossman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox