Skip to contentSkip to conversation

CFI 1.4 intel cmdset in linux-2.4.21

DISCUSSION Jason Chen 3 participants 3 messages Mar 18, 2006 – Apr 4, 2006 Memory technology devices (MTD)

lore
Share & tools
lore

Jason Chen

author
#0 lore raw

Hi, all,

I am trying to use cfi 1.4 in linux-2.4.21(use Intel P30 strata flash), as I find in datasheet, Intel extended query structure is almost the same in CFI 1.3 & 1.4.

So I just modified some code about CFI MinorVersion's judgement in cfi_cmdset_0001.c and cfi_cmdset_0001.h:

I got CFI_QUERY_SIZE as 36, and I can read the MajorVersion, MinorVersion etc in the query, but the number of device hard-partition always read as zero.

What happened? What should I do to solve this issue?

in cfi_cmdset_0001.h:

..

#define CFI_READ_QUERY(map, base, adr, extp, size) \

do { \

         struct cfi_private *__cfi = map->fldrv_priv; \

         int __ofs_factor = __cfi->interleave * __cfi->device_type; \

         int __i; \

         for (__i=0; __i<(size); __i++)  \

                   ((unsigned char*)(extp))[__i] =  \

                            cfi_read_query(map,

(base+(((adr)+__i)*__ofs_factor))); \

}while(0);

#define CFI_QUERY_SIZE(map, base, adr) ({ \

         struct cfi_private *__cfi = map->fldrv_priv; \

         int __ofs_factor = __cfi->interleave * __cfi->device_type; \

         struct cfi_pri_intelext __ext; \

         struct cfi_intelext_regioninfo __rinfo; \

         int __ofs = 0, __num_r, __ri; \

         CFI_READ_QUERY(map, base, adr, (&__ext), sizeof(__ext)); \

         __ofs += sizeof(__ext); \

         if (__ext.MajorVersion == '1' && ((__ext.MinorVersion == '3') ||

(__ext.MinorVersion == '4'))) { \

                   __ofs += (__ext.NumProtectionFields - 1) * (sizeof(__u32)

+ 6); \

                   __ofs += 6; \

                   __num_r = cfi_read_query(map, (base +

((adr+__ofs)*__ofs_factor))); \

                   __ofs ++; \

                   for (__ri=0; __ri < __num_r; __ri++) { \

                            CFI_READ_QUERY(map, base, adr+__ofs, (&__rinfo),

sizeof(__rinfo)); \

                            __ofs += sizeof(__rinfo); \

                            __ofs += (__rinfo.NumBlockTypes - 1) *

sizeof(struct cfi_intelext_blockinfo); \

                   } \

         } \

         __ofs; \

})

..

#1 lore raw
Quoted 6 lines · Jason Chen

Hi, all,

I am trying to use cfi 1.4 in linux-2.4.21(use Intel P30 strata flash), as I find in datasheet, Intel extended query structure is almost the same in CFI 1.3 & 1.4.

[...]

Quoted 2 lines

What happened? What should I do to solve this issue?

Upgrade to a later kernel where this is known to be fixed, or backport the latest MTD snapshot to your old kernel (but then you're on your own if you do so).

Nicolas

#2 lore raw
In reply to Jason Chen

Hi Chen,

It looks that you have updated MTD of Linux 2.4.21. Default MTD of Linux 2.4.21 doesn't attempt to parse h/w partitions.

To avoid issues I would recommend you to use Linux 2.4.21 without additional MTD patches. This case just substitution of '3' for '4' in cfi_cmdset_0001.c will help you.

Thanks,
Alexey