2008-06-20 15:24:53

by Nicolas Ferre

[permalink] [raw]
Subject: sdio: bad CISTPL_FUNCE error

Hi Pierre,

While trying to setup a GPS SDIO card, I experience the following error:
"mmc0: bad CISTPL_FUNCE size 28 type 1"

I use a combo card but without mirco sd card inserted.
http://www.spectec.com.tw/sdg810.htm

Tracing in sdio_cis.c file, I print the tpl_code (line 216).
I have 3 successive codes : 0xff, 0x21 & 0x22.

Is this a host controller driver issue ? or the using of a non
supported combo SDIO card (with GPS function not probed first) ?


Here is a little log :
"
[..SDIO init & many 52 commands..]
mmc0: starting CMD52 arg 00209e00 flags 00000195
Sending command 52 as 00001074, arg = 00209E00, blocks = 0, length = 0 (MR = 00001B84)
MCI irq: status = 0000C3E5, C07F0001, 00000001
Command ready
Completed command
Status = 00000001/0000c3e5 [000010FF 00000000 00000000 00000000]
mmc0: req done (CMD52): 0: 000010ff 00000000 00000000 00000000
mmc0: *read tpl 0xff*
mmc0: clock 25000000Hz busmode 2 powermode 2 cs 0 Vdd 20 width 0 timing 0
clkdiv = 1. mcck = 24832000
MMC: Setting controller bus width to 1
mmc0: starting CMD52 arg 00000e00 flags 00000195
Sending command 52 as 00001074, arg = 00000E00, blocks = 0, length = 0 (MR = 00001B01)
MCI irq: status = 0000C3E5, C07F0001, 00000001
Command ready
Completed command
Status = 00000001/0000c3e5 [00001040 00000000 00000000 00000000]
mmc0: req done (CMD52): 0: 00001040 00000000 00000000 00000000

[..many 52 commands..]

mmc0: starting CMD52 arg 0020a000 flags 00000195
Sending command 52 as 00001074, arg = 0020A000, blocks = 0, length = 0 (MR = 00001B01)
MCI irq: status = 0000C1E5, C07F0001, 00000001
Command ready
Completed command
Status = 00000001/0000c1e5 [00001021 00000000 00000000 00000000]
mmc0: req done (CMD52): 0: 00001021 00000000 00000000 00000000
mmc0: *read tpl 0x21*
mmc0: starting CMD52 arg 0020a200 flags 00000195
Sending command 52 as 00001074, arg = 0020A200, blocks = 0, length = 0 (MR = 00001B01)
MCI irq: status = 0000C1E5, C07F0001, 00000001
Command ready
Completed command
Status = 00000001/0000c1e5 [00001002 00000000 00000000 00000000]
mmc0: req done (CMD52): 0: 00001002 00000000 00000000 00000000

[2 CMD52]

mmc0: starting CMD52 arg 0020a800 flags 00000195
Sending command 52 as 00001074, arg = 0020A800, blocks = 0, length = 0 (MR = 00001B01)
MCI irq: status = 0000C0E5, C07F0001, 00000001
Command ready
Completed command
Status = 00000001/0000c0e5 [00001022 00000000 00000000 00000000]
mmc0: req done (CMD52): 0: 00001022 00000000 00000000 00000000
mmc0: *read tpl 0x22*
mmc0: starting CMD52 arg 0020aa00 flags 00000195
Sending command 52 as 00001074, arg = 0020AA00, blocks = 0, length = 0 (MR = 00001B01)
MCI irq: status = 0000C1E5, C07F0001, 00000001
Command ready
Completed command
Status = 00000001/0000c1e5 [0000101C 00000000 00000000 00000000]
mmc0: req done (CMD52): 0: 0000101c 00000000 00000000 00000000
mmc0: starting CMD52 arg 0020ac00 flags 00000195

[many CMD52]

mmc0: starting CMD52 arg 0020e200 flags 00000195
Sending command 52 as 00001074, arg = 0020E200, blocks = 0, length = 0 (MR = 00001B01)
MCI irq: status = 0000C0E5, C07F0001, 00000001
Command ready
Completed command
Status = 00000001/0000c0e5 [00001000 00000000 00000000 00000000]
mmc0: req done (CMD52): 0: 00001000 00000000 00000000 00000000
mmc0: bad CISTPL_FUNCE size 28 type 1
mmc0: clock 0Hz busmode 1 powermode 0 cs 0 Vdd 0 width 0 timing 0
MMC: Setting controller bus width to 1
mmc0: error -22 whilst initialising SDIO card
mmc0: clock 0Hz busmode 1 powermode 0 cs 0 Vdd 0 width 0 timing 0
MMC: Setting controller bus width to 1
"

--
Nicolas Ferre


2008-06-21 15:00:34

by Nicolas Pitre

[permalink] [raw]
Subject: Re: sdio: bad CISTPL_FUNCE error

On Fri, 20 Jun 2008, Nicolas Ferre wrote:

> Hi Pierre,
>
> While trying to setup a GPS SDIO card, I experience the following error:
> "mmc0: bad CISTPL_FUNCE size 28 type 1"

Could you apply this patch and see what it shows:

diff --git a/drivers/mmc/core/sdio_cis.c b/drivers/mmc/core/sdio_cis.c
index d5e51b1..60ec4d3 100644
--- a/drivers/mmc/core/sdio_cis.c
+++ b/drivers/mmc/core/sdio_cis.c
@@ -149,8 +149,9 @@ static int cistpl_funce(struct mmc_card *card, struct sdio_func *func,
ret = cistpl_funce_common(card, buf, size);

if (ret) {
- printk(KERN_ERR "%s: bad CISTPL_FUNCE size %u "
- "type %u\n", mmc_hostname(card->host), size, buf[0]);
+ printk(KERN_ERR "%s: bad %s CISTPL_FUNCE size %u type %u\n",
+ mmc_hostname(card->host), func ? "function" : "common",
+ size, buf[0]);
return ret;
}


> I use a combo card but without mirco sd card inserted.
> http://www.spectec.com.tw/sdg810.htm
>
> Tracing in sdio_cis.c file, I print the tpl_code (line 216).
> I have 3 successive codes : 0xff, 0x21 & 0x22.

Again that would be good to know if/when func is NULL when those are
parsed.

> Is this a host controller driver issue ?

Most probably not.


Nicolas

2008-06-23 14:12:22

by Nicolas Ferre

[permalink] [raw]
Subject: Re: sdio: bad CISTPL_FUNCE error

Nicolas Pitre :
> On Fri, 20 Jun 2008, Nicolas Ferre wrote:
>
>> Hi Pierre,
>>
>> While trying to setup a GPS SDIO card, I experience the following error:
>> "mmc0: bad CISTPL_FUNCE size 28 type 1"
>
> Could you apply this patch and see what it shows:
>
> diff --git a/drivers/mmc/core/sdio_cis.c b/drivers/mmc/core/sdio_cis.c
> index d5e51b1..60ec4d3 100644
> --- a/drivers/mmc/core/sdio_cis.c
> +++ b/drivers/mmc/core/sdio_cis.c
> @@ -149,8 +149,9 @@ static int cistpl_funce(struct mmc_card *card, struct sdio_func *func,
> ret = cistpl_funce_common(card, buf, size);
>
> if (ret) {
> - printk(KERN_ERR "%s: bad CISTPL_FUNCE size %u "
> - "type %u\n", mmc_hostname(card->host), size, buf[0]);
> + printk(KERN_ERR "%s: bad %s CISTPL_FUNCE size %u type %u\n",
> + mmc_hostname(card->host), func ? "function" : "common",
> + size, buf[0]);
> return ret;
> }
>
>
>> I use a combo card but without mirco sd card inserted.
>> http://www.spectec.com.tw/sdg810.htm
>>
>> Tracing in sdio_cis.c file, I print the tpl_code (line 216).
>> I have 3 successive codes : 0xff, 0x21 & 0x22.
>
> Again that would be good to know if/when func is NULL when those are
> parsed.

Here is the log :
mmc0: bad function CISTPL_FUNCE size 28 type 1

with code 0x22.

Thanks for your help. Regards,
--
Nicolas Ferre

2008-06-23 15:09:51

by Nicolas Pitre

[permalink] [raw]
Subject: Re: sdio: bad CISTPL_FUNCE error

On Mon, 23 Jun 2008, Nicolas Ferre wrote:

> Here is the log :
> mmc0: bad function CISTPL_FUNCE size 28 type 1

If you look in cistpl_funce_func() you'll find this code:

vsn = func->card->cccr.sdio_vsn;
min_size = (vsn == SDIO_SDIO_REV_1_00) ? 28 : 42;
if (size < min_size || buf[0] != 1)
return -EINVAL;

I suspect your card might be buggy wrt the SDIO standard.

You could try printing out the value of vsn here, and then hardcode it
to SDIO_SDIO_REV_1_00 to see if that helps.


Nicolas

2008-06-24 09:35:21

by Nicolas Ferre

[permalink] [raw]
Subject: Re: sdio: bad CISTPL_FUNCE error

Nicolas Pitre :
> On Mon, 23 Jun 2008, Nicolas Ferre wrote:
>
>> Here is the log :
>> mmc0: bad function CISTPL_FUNCE size 28 type 1
>
> If you look in cistpl_funce_func() you'll find this code:
>
> vsn = func->card->cccr.sdio_vsn;
> min_size = (vsn == SDIO_SDIO_REV_1_00) ? 28 : 42;
> if (size < min_size || buf[0] != 1)
> return -EINVAL;
>
> I suspect your card might be buggy wrt the SDIO standard.
>
> You could try printing out the value of vsn here, and then hardcode it
> to SDIO_SDIO_REV_1_00 to see if that helps.

Indeed, I hardcode the value with SDIO_SDIO_REV_1_00 and the card
seems to identify itself better :

vsn = 0x1, buf[0] = 0x1
mmc0: starting CMD52 arg 0020e400 flags 00000195
Sending command 52 as 00001074, arg = 0020E400, blocks = 0, length = 0 (MR = 00001B01)
MCI irq: status = 0000C1E5, C07F0001, 00000001
Command ready
Completed command
Status = 00000001/0000c1e5 [000010FF 00000000 00000000 00000000]
mmc0: req done (CMD52): 0: 000010ff 00000000 00000000 00000000
mmc0: read tpl 0xff
mmc0: new SDIO card at address 0001

So far, so good...

But when going to the next step, it hangs in sdio_uart probing :
mmc0: starting CMD52 arg 800220c0 flags 00000195
Sending command 52 as 00001074, arg = 800220C0, blocks = 0, length = 0 (MR = 00001B01)
MCI irq: status = 0000C1E5, C07F0001, 00000001
Command ready
Completed command
Status = 00000001/0000c1e5 [000010C0 00000000 00000000 00000000]
mmc0: req done (CMD52): 0: 000010c0 00000000 00000000 00000000
mmc0: starting CMD52 arg 80022201 flags 00000195
Sending command 52 as 00001074, arg = 80022201, blocks = 0, length = 0 (MR = 00001B01)
MCI irq: status = 0000C1E5, C07F0001, 00000001
Command ready
Completed command
Status = 00000001/0000c1e5 [00001101 00000000 00000000 00000000]
mmc0: req done (CMD52): 0: 00001101 00000000 00000000 00000000
sdio_uart: probe of mmc0:0001:1 failed with error -34

It seems that I have a out of range error in R5 now...

Regards,
--
Nicolas Ferre