xref: /OK3568_Linux_fs/kernel/Documentation/pcmcia/devicetable.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun============
2*4882a593SmuzhiyunDevice table
3*4882a593Smuzhiyun============
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunMatching of PCMCIA devices to drivers is done using one or more of the
6*4882a593Smuzhiyunfollowing criteria:
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun- manufactor ID
9*4882a593Smuzhiyun- card ID
10*4882a593Smuzhiyun- product ID strings _and_ hashes of these strings
11*4882a593Smuzhiyun- function ID
12*4882a593Smuzhiyun- device function (actual and pseudo)
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunYou should use the helpers in include/pcmcia/device_id.h for generating the
15*4882a593Smuzhiyunstruct pcmcia_device_id[] entries which match devices to drivers.
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunIf you want to match product ID strings, you also need to pass the crc32
18*4882a593Smuzhiyunhashes of the string to the macro, e.g. if you want to match the product ID
19*4882a593Smuzhiyunstring 1, you need to use
20*4882a593Smuzhiyun
21*4882a593SmuzhiyunPCMCIA_DEVICE_PROD_ID1("some_string", 0x(hash_of_some_string)),
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunIf the hash is incorrect, the kernel will inform you about this in "dmesg"
24*4882a593Smuzhiyunupon module initialization, and tell you of the correct hash.
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunYou can determine the hash of the product ID strings by catting the file
27*4882a593Smuzhiyun"modalias" in the sysfs directory of the PCMCIA device. It generates a string
28*4882a593Smuzhiyunin the following form:
29*4882a593Smuzhiyunpcmcia:m0149cC1ABf06pfn00fn00pa725B842DpbF1EFEE84pc0877B627pd00000000
30*4882a593Smuzhiyun
31*4882a593SmuzhiyunThe hex value after "pa" is the hash of product ID string 1, after "pb" for
32*4882a593Smuzhiyunstring 2 and so on.
33*4882a593Smuzhiyun
34*4882a593SmuzhiyunAlternatively, you can use crc32hash (see tools/pcmcia/crc32hash.c)
35*4882a593Smuzhiyunto determine the crc32 hash.  Simply pass the string you want to evaluate
36*4882a593Smuzhiyunas argument to this program, e.g.:
37*4882a593Smuzhiyun$ tools/pcmcia/crc32hash "Dual Speed"
38