[Samsung Epic 4G Touch] sfhub:
I finally had a chance to go back and look over this post. So there are actually 2 issues you are talking about here:

1) the kernel is not setting fwrev when it reads the cid from the device

2) even if the kernel did read the fwrev properly from the device, samsung's firmware restriction range (for the checked in fix) would not match our device (this could potentially be a bug in Samsung's checkin)

Regarding #1, I am wondering how you are determining the bits between prod_name and serial are the fwrev. According to JEDEC specs you posted earlier those bits are the "Product Revision" and they are 2 BCD-coded 4-bit numbers.

It is possible "Product Revision"/"PRV" can be treated as fwrev, but I didn't see anything that said it should be treated that way so is that an assumption you are making?

Further the specs for PRV say that it should be treated as 2 BCD-coded 4-bit nibbles, so if our CID has 0x19 for the PRV, it should be treated as version 1.9 (0x01 . 0x09) rather than version 25 (1x16 + 9x1 = 25)

In the code in mmc.c, the 2 BCD-coded 4-bit nibble representation ties in better with the JEDEC/MMCA v1 case (where they do treat it has 2 x 4-bit nibbles)

switch (card->csd.mmca_vsn) {
...
case 1: /* MMC v1.4 */
card->cid.manfid = UNSTUFF_BITS(resp, 104, 24);
card->cid.prod_name[0] = UNSTUFF_BITS(resp, 96, 8);
card->cid.prod_name[1] = UNSTUFF_BITS(resp, 88, 8);
card->cid.prod_name[2] = UNSTUFF_BITS(resp, 80, 8);
card->cid.prod_name[3] = UNSTUFF_BITS(resp, 72, 8);
card->cid.prod_name[4] = UNSTUFF_BITS(resp, 64, 8);
card->cid.prod_name[5] = UNSTUFF_BITS(resp, 56, 8);
card->cid.prod_name[6] = UNSTUFF_BITS(resp, 48, 8);
[B][I]card->cid.hwrev = UNSTUFF_BITS(resp, [U]44, 4[/U]);[/I][/B]
[B][I]card->cid.fwrev = UNSTUFF_BITS(resp, [U]40, 4[/U]);[/I][/B]
card->cid.serial = UNSTUFF_BITS(resp, 16, 24);
card->cid.month = UNSTUFF_BITS(resp, 12, 4);
card->cid.year = UNSTUFF_BITS(resp, 8, 4) + 1997;
break;

However as noted earlier, the v1 breakdown for cid doesn't match our cid spec because we have a 6 character prod_name and v1 has a 7 character prod_name, so that makes it likely our kernel is taking the v4 code path.

In our section (the v4 cid breakdown), it makes no mention of setting hwrev and fwrev, so presumably they are set to 0 by the kzalloc of the mmc_card data structure.

switch (card->csd.mmca_vsn) {
...
case 4: /* MMC v4 */ (Our Case!)
card->cid.manfid = UNSTUFF_BITS(resp, 120, 8);
card->cid.oemid = UNSTUFF_BITS(resp, 104, 16);
card->cid.prod_name[0] = UNSTUFF_BITS(resp, 96, 8);
card->cid.prod_name[1] = UNSTUFF_BITS(resp, 88, 8);
card->cid.prod_name[2] = UNSTUFF_BITS(resp, 80, 8);
card->cid.prod_name[3] = UNSTUFF_BITS(resp, 72, 8);
card->cid.prod_name[4] = UNSTUFF_BITS(resp, 64, 8);
[B][I]card->cid.prod_name[5] = UNSTUFF_BITS(resp, 56, 8);[/I][/B]
[B][I][COLOR="Red"]BITS 48-55 in cid not accounted for[/COLOR][/I][/B]
[B][I]card->cid.serial = UNSTUFF_BITS(resp, 16, 32);[/I][/B]
card->cid.month = UNSTUFF_BITS(resp, 12, 4);
card->cid.year = UNSTUFF_BITS(resp, 8, 4) + 1997;
break;

So *if* we were to make the assumption PRV should be functioning as hwrev and fwrev, for the manual decode, it would appear 0x19 should be interpreted as hwrev=1 and fwrev=9. If we don't make that assumption, then PRV is just 1.9 and we could be comparing apples to oranges.

Now if you try and reconcile this with what Samsung checked in (fwrev=0x25) it seems they are trying to stuff an 8-bit value into a field that should be a 4-bit value.

Anyway, I think there is probably a bug somewhere, either with how Samsung is assuming the fwrev field is used, or how the kernel is using it in the case of mmca_vsn=4 (2nd set of code above)

This is a just a breakdown of the manual decode for the benefit of others or if we need to further discuss:

http://rere.qmqm.pl/~mirq/JESD84-A44.pdf

serial: d3f24fe6
cid: 1501004d414734464119d3f24fe68e8b

1 1 1
2 1 0 9 8 8 7 6 5 4 4 3 2 1
0 2 4 6 8 0 2 4 6 8 0 2 4 6 8 0
1501004d414734464119d3f24fe68e8b

manfid: 0x15
oemid: 0x0100
prod_name: 0x 4D 41 47 34 46 41
M A G 4 F A [ASCII]
[B][I]prv: 0x19 (2 x BCD-coded nibble = version 1.9)[/I][/B]
serial: 0x d3f24fe6
month: 0x08 = 08
year: 0x0E = 14 + 1997 = 2011