mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
Merge master.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6: [PATCH] pcmcia: at91_cf update [PATCH] pcmcia: fix m32r_cfc.c compilation [PATCH] pcmcia: ds.c debug enhancements [PATCH] pcmcia: at91_cf update [PATCH] pcmcia: conf.ConfigBase and conf.Present consolidation [PATCH] pcmcia: remove prod_id indirection [PATCH] pcmcia: remove manf_id and card_id indirection [PATCH] pcmcia: IDs for Elan serial PCMCIA devcies [PATCH] pcmcia: allow for four multifunction subdevices [PATCH] pcmcia: handle __copy_from_user() return value in ioctl [PATCH] pcmcia: multifunction card handling fixes [PATCH] pcmcia: allow shared IRQs on pd6729 sockets [PATCH] pcmcia: start over after CIS override [PATCH] cm4000_cs: fix return value check [PATCH] pcmcia: yet another IDE ID [PATCH] pcmcia: Add an id to ide-cs.c
This commit is contained in:
commit
bf83c2a315
@ -154,19 +154,12 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.TupleDataMax = 255;
|
||||
tuple.Attributes = 0;
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(pdev, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(pdev, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(pdev, &tuple, &stk->parse));
|
||||
pdev->conf.ConfigBase = stk->parse.config.base;
|
||||
pdev->conf.Present = stk->parse.config.rmask[0];
|
||||
|
||||
/* See if we have a manufacturer identifier. Use it to set is_kme for
|
||||
vendor quirks */
|
||||
tuple.DesiredTuple = CISTPL_MANFID;
|
||||
if (!pcmcia_get_first_tuple(pdev, &tuple) && !pcmcia_get_tuple_data(pdev, &tuple) && !pcmcia_parse_tuple(pdev, &tuple, &stk->parse))
|
||||
is_kme = ((stk->parse.manfid.manf == MANFID_KME) && ((stk->parse.manfid.card == PRODID_KME_KXLC005_A) || (stk->parse.manfid.card == PRODID_KME_KXLC005_B)));
|
||||
is_kme = ((pdev->manf_id == MANFID_KME) &&
|
||||
((pdev->card_id == PRODID_KME_KXLC005_A) ||
|
||||
(pdev->card_id == PRODID_KME_KXLC005_B)));
|
||||
|
||||
/* Not sure if this is right... look up the current Vcc */
|
||||
CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(pdev, &stk->conf));
|
||||
@ -356,8 +349,10 @@ static struct pcmcia_device_id pcmcia_devices[] = {
|
||||
PCMCIA_DEVICE_PROD_ID12("SMI VENDOR", "SMI PRODUCT", 0x30896c92, 0x703cc5f6),
|
||||
PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003),
|
||||
PCMCIA_DEVICE_PROD_ID1("TRANSCEND 512M ", 0xd0909443),
|
||||
PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS1GCF80", 0x709b1bf1, 0x2a54d4b1),
|
||||
PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF120", 0x709b1bf1, 0xf54a91c8),
|
||||
PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852),
|
||||
PCMCIA_DEVICE_PROD_ID12("WEIDA", "TWTTI", 0xcc7cf69c, 0x212bb918),
|
||||
PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209),
|
||||
PCMCIA_DEVICE_PROD_ID12("STI", "Flash 5.0", 0xbf2df18d, 0x8cb57a0e),
|
||||
PCMCIA_MFC_DEVICE_PROD_ID12(1, "SanDisk", "ConnectPlus", 0x7a954bd9, 0x74be00c6),
|
||||
|
@ -892,43 +892,10 @@ static void bluecard_detach(struct pcmcia_device *link)
|
||||
}
|
||||
|
||||
|
||||
static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = pcmcia_get_first_tuple(handle, tuple);
|
||||
if (i != CS_SUCCESS)
|
||||
return CS_NO_MORE_ITEMS;
|
||||
|
||||
i = pcmcia_get_tuple_data(handle, tuple);
|
||||
if (i != CS_SUCCESS)
|
||||
return i;
|
||||
|
||||
return pcmcia_parse_tuple(handle, tuple, parse);
|
||||
}
|
||||
|
||||
static int bluecard_config(struct pcmcia_device *link)
|
||||
{
|
||||
bluecard_info_t *info = link->priv;
|
||||
tuple_t tuple;
|
||||
u_short buf[256];
|
||||
cisparse_t parse;
|
||||
int i, n, last_ret, last_fn;
|
||||
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.TupleDataMax = 255;
|
||||
tuple.Attributes = 0;
|
||||
|
||||
/* Get configuration register information */
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
last_ret = first_tuple(link, &tuple, &parse);
|
||||
if (last_ret != CS_SUCCESS) {
|
||||
last_fn = ParseTuple;
|
||||
goto cs_failed;
|
||||
}
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
int i, n;
|
||||
|
||||
link->conf.ConfigIndex = 0x20;
|
||||
link->io.NumPorts1 = 64;
|
||||
@ -966,9 +933,6 @@ static int bluecard_config(struct pcmcia_device *link)
|
||||
|
||||
return 0;
|
||||
|
||||
cs_failed:
|
||||
cs_error(link, last_fn, last_ret);
|
||||
|
||||
failed:
|
||||
bluecard_release(link);
|
||||
return -ENODEV;
|
||||
|
@ -713,22 +713,7 @@ static int bt3c_config(struct pcmcia_device *link)
|
||||
u_short buf[256];
|
||||
cisparse_t parse;
|
||||
cistpl_cftable_entry_t *cf = &parse.cftable_entry;
|
||||
int i, j, try, last_ret, last_fn;
|
||||
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.TupleDataMax = 255;
|
||||
tuple.Attributes = 0;
|
||||
|
||||
/* Get configuration register information */
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
last_ret = first_tuple(link, &tuple, &parse);
|
||||
if (last_ret != CS_SUCCESS) {
|
||||
last_fn = ParseTuple;
|
||||
goto cs_failed;
|
||||
}
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
int i, j, try;
|
||||
|
||||
/* First pass: look for a config entry that looks normal. */
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
@ -802,9 +787,6 @@ found_port:
|
||||
|
||||
return 0;
|
||||
|
||||
cs_failed:
|
||||
cs_error(link, last_fn, last_ret);
|
||||
|
||||
failed:
|
||||
bt3c_release(link);
|
||||
return -ENODEV;
|
||||
|
@ -644,22 +644,7 @@ static int btuart_config(struct pcmcia_device *link)
|
||||
u_short buf[256];
|
||||
cisparse_t parse;
|
||||
cistpl_cftable_entry_t *cf = &parse.cftable_entry;
|
||||
int i, j, try, last_ret, last_fn;
|
||||
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.TupleDataMax = 255;
|
||||
tuple.Attributes = 0;
|
||||
|
||||
/* Get configuration register information */
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
last_ret = first_tuple(link, &tuple, &parse);
|
||||
if (last_ret != CS_SUCCESS) {
|
||||
last_fn = ParseTuple;
|
||||
goto cs_failed;
|
||||
}
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
int i, j, try;
|
||||
|
||||
/* First pass: look for a config entry that looks normal. */
|
||||
tuple.TupleData = (cisdata_t *) buf;
|
||||
@ -734,9 +719,6 @@ found_port:
|
||||
|
||||
return 0;
|
||||
|
||||
cs_failed:
|
||||
cs_error(link, last_fn, last_ret);
|
||||
|
||||
failed:
|
||||
btuart_release(link);
|
||||
return -ENODEV;
|
||||
|
@ -626,22 +626,7 @@ static int dtl1_config(struct pcmcia_device *link)
|
||||
u_short buf[256];
|
||||
cisparse_t parse;
|
||||
cistpl_cftable_entry_t *cf = &parse.cftable_entry;
|
||||
int i, last_ret, last_fn;
|
||||
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.TupleDataMax = 255;
|
||||
tuple.Attributes = 0;
|
||||
|
||||
/* Get configuration register information */
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
last_ret = first_tuple(link, &tuple, &parse);
|
||||
if (last_ret != CS_SUCCESS) {
|
||||
last_fn = ParseTuple;
|
||||
goto cs_failed;
|
||||
}
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
int i;
|
||||
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleOffset = 0;
|
||||
@ -690,9 +675,6 @@ static int dtl1_config(struct pcmcia_device *link)
|
||||
|
||||
return 0;
|
||||
|
||||
cs_failed:
|
||||
cs_error(link, last_fn, last_ret);
|
||||
|
||||
failed:
|
||||
dtl1_release(link);
|
||||
return -ENODEV;
|
||||
|
@ -1764,29 +1764,11 @@ static int cm4000_config(struct pcmcia_device * link, int devno)
|
||||
int rc;
|
||||
|
||||
/* read the config-tuples */
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
|
||||
if ((fail_rc = pcmcia_get_first_tuple(link, &tuple)) != CS_SUCCESS) {
|
||||
fail_fn = GetFirstTuple;
|
||||
goto cs_failed;
|
||||
}
|
||||
if ((fail_rc = pcmcia_get_tuple_data(link, &tuple)) != CS_SUCCESS) {
|
||||
fail_fn = GetTupleData;
|
||||
goto cs_failed;
|
||||
}
|
||||
if ((fail_rc =
|
||||
pcmcia_parse_tuple(link, &tuple, &parse)) != CS_SUCCESS) {
|
||||
fail_fn = ParseTuple;
|
||||
goto cs_failed;
|
||||
}
|
||||
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
link->io.BasePort2 = 0;
|
||||
link->io.NumPorts2 = 0;
|
||||
link->io.Attributes2 = 0;
|
||||
@ -1841,8 +1823,6 @@ static int cm4000_config(struct pcmcia_device * link, int devno)
|
||||
|
||||
return 0;
|
||||
|
||||
cs_failed:
|
||||
cs_error(link, fail_fn, fail_rc);
|
||||
cs_release:
|
||||
cm4000_release(link);
|
||||
return -ENODEV;
|
||||
@ -1973,14 +1953,14 @@ static int __init cmm_init(void)
|
||||
printk(KERN_INFO "%s\n", version);
|
||||
|
||||
cmm_class = class_create(THIS_MODULE, "cardman_4000");
|
||||
if (!cmm_class)
|
||||
return -1;
|
||||
if (IS_ERR(cmm_class))
|
||||
return PTR_ERR(cmm_class);
|
||||
|
||||
major = register_chrdev(0, DEVICE_NAME, &cm4000_fops);
|
||||
if (major < 0) {
|
||||
printk(KERN_WARNING MODULE_NAME
|
||||
": could not get major number\n");
|
||||
return -1;
|
||||
return major;
|
||||
}
|
||||
|
||||
rc = pcmcia_register_driver(&cm4000_driver);
|
||||
|
@ -523,29 +523,11 @@ static int reader_config(struct pcmcia_device *link, int devno)
|
||||
int fail_fn, fail_rc;
|
||||
int rc;
|
||||
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
|
||||
if ((fail_rc = pcmcia_get_first_tuple(link, &tuple)) != CS_SUCCESS) {
|
||||
fail_fn = GetFirstTuple;
|
||||
goto cs_failed;
|
||||
}
|
||||
if ((fail_rc = pcmcia_get_tuple_data(link, &tuple)) != CS_SUCCESS) {
|
||||
fail_fn = GetTupleData;
|
||||
goto cs_failed;
|
||||
}
|
||||
if ((fail_rc = pcmcia_parse_tuple(link, &tuple, &parse))
|
||||
!= CS_SUCCESS) {
|
||||
fail_fn = ParseTuple;
|
||||
goto cs_failed;
|
||||
}
|
||||
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
link->io.BasePort2 = 0;
|
||||
link->io.NumPorts2 = 0;
|
||||
link->io.Attributes2 = 0;
|
||||
@ -609,8 +591,6 @@ static int reader_config(struct pcmcia_device *link, int devno)
|
||||
|
||||
return 0;
|
||||
|
||||
cs_failed:
|
||||
cs_error(link, fail_fn, fail_rc);
|
||||
cs_release:
|
||||
reader_release(link);
|
||||
return -ENODEV;
|
||||
@ -721,14 +701,14 @@ static int __init cm4040_init(void)
|
||||
|
||||
printk(KERN_INFO "%s\n", version);
|
||||
cmx_class = class_create(THIS_MODULE, "cardman_4040");
|
||||
if (!cmx_class)
|
||||
return -1;
|
||||
if (IS_ERR(cmx_class))
|
||||
return PTR_ERR(cmx_class);
|
||||
|
||||
major = register_chrdev(0, DEVICE_NAME, &reader_fops);
|
||||
if (major < 0) {
|
||||
printk(KERN_WARNING MODULE_NAME
|
||||
": could not get major number\n");
|
||||
return -1;
|
||||
return major;
|
||||
}
|
||||
|
||||
rc = pcmcia_register_driver(&reader_driver);
|
||||
|
@ -604,17 +604,10 @@ static int mgslpc_config(struct pcmcia_device *link)
|
||||
if (debug_level >= DEBUG_LEVEL_INFO)
|
||||
printk("mgslpc_config(0x%p)\n", link);
|
||||
|
||||
/* read CONFIG tuple to find its configuration registers */
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
/* get CIS configuration entry */
|
||||
|
||||
|
@ -192,20 +192,10 @@ static int ide_config(struct pcmcia_device *link)
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.TupleDataMax = 255;
|
||||
tuple.Attributes = 0;
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &stk->parse));
|
||||
link->conf.ConfigBase = stk->parse.config.base;
|
||||
link->conf.Present = stk->parse.config.rmask[0];
|
||||
|
||||
tuple.DesiredTuple = CISTPL_MANFID;
|
||||
if (!pcmcia_get_first_tuple(link, &tuple) &&
|
||||
!pcmcia_get_tuple_data(link, &tuple) &&
|
||||
!pcmcia_parse_tuple(link, &tuple, &stk->parse))
|
||||
is_kme = ((stk->parse.manfid.manf == MANFID_KME) &&
|
||||
((stk->parse.manfid.card == PRODID_KME_KXLC005_A) ||
|
||||
(stk->parse.manfid.card == PRODID_KME_KXLC005_B)));
|
||||
is_kme = ((link->manf_id == MANFID_KME) &&
|
||||
((link->card_id == PRODID_KME_KXLC005_A) ||
|
||||
(link->card_id == PRODID_KME_KXLC005_B)));
|
||||
|
||||
/* Not sure if this is right... look up the current Vcc */
|
||||
CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf));
|
||||
@ -408,8 +398,10 @@ static struct pcmcia_device_id ide_ids[] = {
|
||||
PCMCIA_DEVICE_PROD_ID12("SMI VENDOR", "SMI PRODUCT", 0x30896c92, 0x703cc5f6),
|
||||
PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003),
|
||||
PCMCIA_DEVICE_PROD_ID1("TRANSCEND 512M ", 0xd0909443),
|
||||
PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS1GCF80", 0x709b1bf1, 0x2a54d4b1),
|
||||
PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF120", 0x709b1bf1, 0xf54a91c8),
|
||||
PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852),
|
||||
PCMCIA_DEVICE_PROD_ID12("WEIDA", "TWTTI", 0xcc7cf69c, 0x212bb918),
|
||||
PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209),
|
||||
PCMCIA_DEVICE_PROD_ID12("STI", "Flash 5.0", 0xbf2df18d, 0x8cb57a0e),
|
||||
PCMCIA_MFC_DEVICE_PROD_ID12(1, "SanDisk", "ConnectPlus", 0x7a954bd9, 0x74be00c6),
|
||||
|
@ -194,41 +194,11 @@ static int avmcs_config(struct pcmcia_device *link)
|
||||
|
||||
dev = link->priv;
|
||||
|
||||
/*
|
||||
This reads the card's CONFIG tuple to find its configuration
|
||||
registers.
|
||||
*/
|
||||
do {
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
i = pcmcia_get_first_tuple(link, &tuple);
|
||||
if (i != CS_SUCCESS) break;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = 64;
|
||||
tuple.TupleOffset = 0;
|
||||
i = pcmcia_get_tuple_data(link, &tuple);
|
||||
if (i != CS_SUCCESS) break;
|
||||
i = pcmcia_parse_tuple(link, &tuple, &parse);
|
||||
if (i != CS_SUCCESS) break;
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
} while (0);
|
||||
if (i != CS_SUCCESS) {
|
||||
cs_error(link, ParseTuple, i);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
do {
|
||||
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = 254;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.DesiredTuple = CISTPL_VERS_1;
|
||||
|
||||
devname[0] = 0;
|
||||
if( !first_tuple(link, &tuple, &parse) && parse.version_1.ns > 1 ) {
|
||||
strlcpy(devname,parse.version_1.str + parse.version_1.ofs[1],
|
||||
sizeof(devname));
|
||||
}
|
||||
if (link->prod_id[1])
|
||||
strlcpy(devname, link->prod_id[1], sizeof(devname));
|
||||
|
||||
/*
|
||||
* find IO port
|
||||
*/
|
||||
|
@ -216,41 +216,11 @@ static int avma1cs_config(struct pcmcia_device *link)
|
||||
|
||||
DEBUG(0, "avma1cs_config(0x%p)\n", link);
|
||||
|
||||
/*
|
||||
This reads the card's CONFIG tuple to find its configuration
|
||||
registers.
|
||||
*/
|
||||
do {
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
i = pcmcia_get_first_tuple(link, &tuple);
|
||||
if (i != CS_SUCCESS) break;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = 64;
|
||||
tuple.TupleOffset = 0;
|
||||
i = pcmcia_get_tuple_data(link, &tuple);
|
||||
if (i != CS_SUCCESS) break;
|
||||
i = pcmcia_parse_tuple(link, &tuple, &parse);
|
||||
if (i != CS_SUCCESS) break;
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
} while (0);
|
||||
if (i != CS_SUCCESS) {
|
||||
cs_error(link, ParseTuple, i);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
do {
|
||||
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = 254;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.DesiredTuple = CISTPL_VERS_1;
|
||||
|
||||
devname[0] = 0;
|
||||
if( !first_tuple(link, &tuple, &parse) && parse.version_1.ns > 1 ) {
|
||||
strlcpy(devname,parse.version_1.str + parse.version_1.ofs[1],
|
||||
sizeof(devname));
|
||||
}
|
||||
if (link->prod_id[1])
|
||||
strlcpy(devname, link->prod_id[1], sizeof(devname));
|
||||
|
||||
/*
|
||||
* find IO port
|
||||
*/
|
||||
|
@ -242,23 +242,6 @@ static int elsa_cs_config(struct pcmcia_device *link)
|
||||
DEBUG(0, "elsa_config(0x%p)\n", link);
|
||||
dev = link->priv;
|
||||
|
||||
/*
|
||||
This reads the card's CONFIG tuple to find its configuration
|
||||
registers.
|
||||
*/
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleDataMax = 255;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.Attributes = 0;
|
||||
i = first_tuple(link, &tuple, &parse);
|
||||
if (i != CS_SUCCESS) {
|
||||
last_fn = ParseTuple;
|
||||
goto cs_failed;
|
||||
}
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleOffset = 0; tuple.TupleDataMax = 255;
|
||||
tuple.Attributes = 0;
|
||||
|
@ -233,20 +233,10 @@ static int sedlbauer_config(struct pcmcia_device *link)
|
||||
|
||||
DEBUG(0, "sedlbauer_config(0x%p)\n", link);
|
||||
|
||||
/*
|
||||
This reads the card's CONFIG tuple to find its configuration
|
||||
registers.
|
||||
*/
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &conf));
|
||||
|
||||
|
@ -232,23 +232,6 @@ static int teles_cs_config(struct pcmcia_device *link)
|
||||
DEBUG(0, "teles_config(0x%p)\n", link);
|
||||
dev = link->priv;
|
||||
|
||||
/*
|
||||
This reads the card's CONFIG tuple to find its configuration
|
||||
registers.
|
||||
*/
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleDataMax = 255;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.Attributes = 0;
|
||||
i = first_tuple(link, &tuple, &parse);
|
||||
if (i != CS_SUCCESS) {
|
||||
last_fn = ParseTuple;
|
||||
goto cs_failed;
|
||||
}
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleOffset = 0; tuple.TupleDataMax = 255;
|
||||
tuple.Attributes = 0;
|
||||
|
@ -338,7 +338,6 @@ static int tc574_config(struct pcmcia_device *link)
|
||||
struct net_device *dev = link->priv;
|
||||
struct el3_private *lp = netdev_priv(dev);
|
||||
tuple_t tuple;
|
||||
cisparse_t parse;
|
||||
unsigned short buf[32];
|
||||
int last_fn, last_ret, i, j;
|
||||
kio_addr_t ioaddr;
|
||||
@ -350,17 +349,6 @@ static int tc574_config(struct pcmcia_device *link)
|
||||
|
||||
DEBUG(0, "3c574_config(0x%p)\n", link);
|
||||
|
||||
tuple.Attributes = 0;
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleDataMax = 64;
|
||||
tuple.TupleOffset = 0;
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
link->io.IOAddrLines = 16;
|
||||
for (i = j = 0; j < 0x400; j += 0x20) {
|
||||
link->io.BasePort1 = j ^ 0x300;
|
||||
@ -382,6 +370,10 @@ static int tc574_config(struct pcmcia_device *link)
|
||||
/* The 3c574 normally uses an EEPROM for configuration info, including
|
||||
the hardware address. The future products may include a modem chip
|
||||
and put the address in the CIS. */
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleDataMax = 64;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.DesiredTuple = 0x88;
|
||||
if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
|
||||
pcmcia_get_tuple_data(link, &tuple);
|
||||
@ -397,12 +389,9 @@ static int tc574_config(struct pcmcia_device *link)
|
||||
goto failed;
|
||||
}
|
||||
}
|
||||
tuple.DesiredTuple = CISTPL_VERS_1;
|
||||
if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS &&
|
||||
pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS &&
|
||||
pcmcia_parse_tuple(link, &tuple, &parse) == CS_SUCCESS) {
|
||||
cardname = parse.version_1.str + parse.version_1.ofs[1];
|
||||
} else
|
||||
if (link->prod_id[1])
|
||||
cardname = link->prod_id[1];
|
||||
else
|
||||
cardname = "3Com 3c574";
|
||||
|
||||
{
|
||||
|
@ -253,7 +253,6 @@ static int tc589_config(struct pcmcia_device *link)
|
||||
struct net_device *dev = link->priv;
|
||||
struct el3_private *lp = netdev_priv(dev);
|
||||
tuple_t tuple;
|
||||
cisparse_t parse;
|
||||
u16 buf[32], *phys_addr;
|
||||
int last_fn, last_ret, i, j, multi = 0, fifo;
|
||||
kio_addr_t ioaddr;
|
||||
@ -263,26 +262,16 @@ static int tc589_config(struct pcmcia_device *link)
|
||||
|
||||
phys_addr = (u16 *)dev->dev_addr;
|
||||
tuple.Attributes = 0;
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
/* Is this a 3c562? */
|
||||
tuple.DesiredTuple = CISTPL_MANFID;
|
||||
tuple.Attributes = TUPLE_RETURN_COMMON;
|
||||
if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) &&
|
||||
(pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS)) {
|
||||
if (le16_to_cpu(buf[0]) != MANFID_3COM)
|
||||
|
||||
/* Is this a 3c562? */
|
||||
if (link->manf_id != MANFID_3COM)
|
||||
printk(KERN_INFO "3c589_cs: hmmm, is this really a "
|
||||
"3Com card??\n");
|
||||
multi = (le16_to_cpu(buf[1]) == PRODID_3COM_3C562);
|
||||
}
|
||||
multi = (link->card_id == PRODID_3COM_3C562);
|
||||
|
||||
/* For the 3c562, the base address must be xx00-xx7f */
|
||||
link->io.IOAddrLines = 16;
|
||||
|
@ -299,11 +299,7 @@ static int axnet_config(struct pcmcia_device *link)
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
|
||||
/* don't trust the CIS on this; Linksys got it wrong */
|
||||
link->conf.Present = 0x63;
|
||||
|
||||
|
@ -249,12 +249,9 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
||||
static int com20020_config(struct pcmcia_device *link)
|
||||
{
|
||||
struct arcnet_local *lp;
|
||||
tuple_t tuple;
|
||||
cisparse_t parse;
|
||||
com20020_dev_t *info;
|
||||
struct net_device *dev;
|
||||
int i, last_ret, last_fn;
|
||||
u_char buf[64];
|
||||
int ioaddr;
|
||||
|
||||
info = link->priv;
|
||||
@ -264,16 +261,6 @@ static int com20020_config(struct pcmcia_device *link)
|
||||
|
||||
DEBUG(0, "com20020_config(0x%p)\n", link);
|
||||
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = 64;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
|
||||
DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1);
|
||||
i = !CS_SUCCESS;
|
||||
if (!link->io.BasePort1)
|
||||
|
@ -342,7 +342,7 @@ static int fmvj18x_config(struct pcmcia_device *link)
|
||||
tuple_t tuple;
|
||||
cisparse_t parse;
|
||||
u_short buf[32];
|
||||
int i, last_fn, last_ret, ret;
|
||||
int i, last_fn = 0, last_ret = 0, ret;
|
||||
kio_addr_t ioaddr;
|
||||
cardtype_t cardtype;
|
||||
char *card_name = "unknown";
|
||||
@ -350,21 +350,9 @@ static int fmvj18x_config(struct pcmcia_device *link)
|
||||
|
||||
DEBUG(0, "fmvj18x_config(0x%p)\n", link);
|
||||
|
||||
/*
|
||||
This reads the card's CONFIG tuple to find its configuration
|
||||
registers.
|
||||
*/
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
tuple.TupleData = (u_char *)buf;
|
||||
tuple.TupleDataMax = 64;
|
||||
tuple.TupleOffset = 0;
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
tuple.DesiredTuple = CISTPL_FUNCE;
|
||||
tuple.TupleOffset = 0;
|
||||
if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
|
||||
@ -374,17 +362,12 @@ static int fmvj18x_config(struct pcmcia_device *link)
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigIndex = parse.cftable_entry.index;
|
||||
tuple.DesiredTuple = CISTPL_MANFID;
|
||||
if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS)
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
else
|
||||
buf[0] = 0xffff;
|
||||
switch (le16_to_cpu(buf[0])) {
|
||||
switch (link->manf_id) {
|
||||
case MANFID_TDK:
|
||||
cardtype = TDK;
|
||||
if (le16_to_cpu(buf[1]) == PRODID_TDK_GN3410
|
||||
|| le16_to_cpu(buf[1]) == PRODID_TDK_NP9610
|
||||
|| le16_to_cpu(buf[1]) == PRODID_TDK_MN3200) {
|
||||
if (link->card_id == PRODID_TDK_GN3410
|
||||
|| link->card_id == PRODID_TDK_NP9610
|
||||
|| link->card_id == PRODID_TDK_MN3200) {
|
||||
/* MultiFunction Card */
|
||||
link->conf.ConfigBase = 0x800;
|
||||
link->conf.ConfigIndex = 0x47;
|
||||
@ -395,11 +378,11 @@ static int fmvj18x_config(struct pcmcia_device *link)
|
||||
cardtype = CONTEC;
|
||||
break;
|
||||
case MANFID_FUJITSU:
|
||||
if (le16_to_cpu(buf[1]) == PRODID_FUJITSU_MBH10302)
|
||||
if (link->card_id == PRODID_FUJITSU_MBH10302)
|
||||
/* RATOC REX-5588/9822/4886's PRODID are 0004(=MBH10302),
|
||||
but these are MBH10304 based card. */
|
||||
cardtype = MBH10304;
|
||||
else if (le16_to_cpu(buf[1]) == PRODID_FUJITSU_MBH10304)
|
||||
else if (link->card_id == PRODID_FUJITSU_MBH10304)
|
||||
cardtype = MBH10304;
|
||||
else
|
||||
cardtype = LA501;
|
||||
@ -409,14 +392,9 @@ static int fmvj18x_config(struct pcmcia_device *link)
|
||||
}
|
||||
} else {
|
||||
/* old type card */
|
||||
tuple.DesiredTuple = CISTPL_MANFID;
|
||||
if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS)
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
else
|
||||
buf[0] = 0xffff;
|
||||
switch (le16_to_cpu(buf[0])) {
|
||||
switch (link->manf_id) {
|
||||
case MANFID_FUJITSU:
|
||||
if (le16_to_cpu(buf[1]) == PRODID_FUJITSU_MBH10304) {
|
||||
if (link->card_id == PRODID_FUJITSU_MBH10304) {
|
||||
cardtype = XXX10304; /* MBH10304 with buggy CIS */
|
||||
link->conf.ConfigIndex = 0x20;
|
||||
} else {
|
||||
|
@ -222,24 +222,12 @@ static int ibmtr_config(struct pcmcia_device *link)
|
||||
ibmtr_dev_t *info = link->priv;
|
||||
struct net_device *dev = info->dev;
|
||||
struct tok_info *ti = netdev_priv(dev);
|
||||
tuple_t tuple;
|
||||
cisparse_t parse;
|
||||
win_req_t req;
|
||||
memreq_t mem;
|
||||
int i, last_ret, last_fn;
|
||||
u_char buf[64];
|
||||
|
||||
DEBUG(0, "ibmtr_config(0x%p)\n", link);
|
||||
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = 64;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.ConfigIndex = 0x61;
|
||||
|
||||
/* Determine if this is PRIMARY or ALTERNATE. */
|
||||
|
@ -656,23 +656,12 @@ static int nmclan_config(struct pcmcia_device *link)
|
||||
struct net_device *dev = link->priv;
|
||||
mace_private *lp = netdev_priv(dev);
|
||||
tuple_t tuple;
|
||||
cisparse_t parse;
|
||||
u_char buf[64];
|
||||
int i, last_ret, last_fn;
|
||||
kio_addr_t ioaddr;
|
||||
|
||||
DEBUG(0, "nmclan_config(0x%p)\n", link);
|
||||
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = 64;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
|
||||
CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
|
||||
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
|
||||
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
|
||||
@ -686,6 +675,7 @@ static int nmclan_config(struct pcmcia_device *link)
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = 64;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.Attributes = 0;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
memcpy(dev->dev_addr, tuple.TupleData, ETHER_ADDR_LEN);
|
||||
|
@ -519,31 +519,15 @@ static int pcnet_config(struct pcmcia_device *link)
|
||||
tuple_t tuple;
|
||||
cisparse_t parse;
|
||||
int i, last_ret, last_fn, start_pg, stop_pg, cm_offset;
|
||||
int manfid = 0, prodid = 0, has_shmem = 0;
|
||||
int has_shmem = 0;
|
||||
u_short buf[64];
|
||||
hw_info_t *hw_info;
|
||||
|
||||
DEBUG(0, "pcnet_config(0x%p)\n", link);
|
||||
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
tuple.DesiredTuple = CISTPL_MANFID;
|
||||
tuple.Attributes = TUPLE_RETURN_COMMON;
|
||||
if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) &&
|
||||
(pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS)) {
|
||||
manfid = le16_to_cpu(buf[0]);
|
||||
prodid = le16_to_cpu(buf[1]);
|
||||
}
|
||||
|
||||
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
|
||||
tuple.Attributes = 0;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
@ -589,8 +573,8 @@ static int pcnet_config(struct pcmcia_device *link)
|
||||
link->conf.Attributes |= CONF_ENABLE_SPKR;
|
||||
link->conf.Status = CCSR_AUDIO_ENA;
|
||||
}
|
||||
if ((manfid == MANFID_IBM) &&
|
||||
(prodid == PRODID_IBM_HOME_AND_AWAY))
|
||||
if ((link->manf_id == MANFID_IBM) &&
|
||||
(link->card_id == PRODID_IBM_HOME_AND_AWAY))
|
||||
link->conf.ConfigIndex |= 0x10;
|
||||
|
||||
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
|
||||
@ -624,10 +608,10 @@ static int pcnet_config(struct pcmcia_device *link)
|
||||
info->flags = hw_info->flags;
|
||||
/* Check for user overrides */
|
||||
info->flags |= (delay_output) ? DELAY_OUTPUT : 0;
|
||||
if ((manfid == MANFID_SOCKET) &&
|
||||
((prodid == PRODID_SOCKET_LPE) ||
|
||||
(prodid == PRODID_SOCKET_LPE_CF) ||
|
||||
(prodid == PRODID_SOCKET_EIO)))
|
||||
if ((link->manf_id == MANFID_SOCKET) &&
|
||||
((link->card_id == PRODID_SOCKET_LPE) ||
|
||||
(link->card_id == PRODID_SOCKET_LPE_CF) ||
|
||||
(link->card_id == PRODID_SOCKET_EIO)))
|
||||
info->flags &= ~USE_BIG_BUF;
|
||||
if (!use_big_buf)
|
||||
info->flags &= ~USE_BIG_BUF;
|
||||
|
@ -560,16 +560,8 @@ static int mhz_setup(struct pcmcia_device *link)
|
||||
|
||||
/* Read the station address from the CIS. It is stored as the last
|
||||
(fourth) string in the Version 1 Version/ID tuple. */
|
||||
tuple->DesiredTuple = CISTPL_VERS_1;
|
||||
if (first_tuple(link, tuple, parse) != CS_SUCCESS) {
|
||||
rc = -1;
|
||||
goto free_cfg_mem;
|
||||
}
|
||||
/* Ugh -- the EM1144 card has two VERS_1 tuples!?! */
|
||||
if (next_tuple(link, tuple, parse) != CS_SUCCESS)
|
||||
first_tuple(link, tuple, parse);
|
||||
if (parse->version_1.ns > 3) {
|
||||
station_addr = parse->version_1.str + parse->version_1.ofs[3];
|
||||
if (link->prod_id[3]) {
|
||||
station_addr = link->prod_id[3];
|
||||
if (cvt_ascii_address(dev, station_addr) == 0) {
|
||||
rc = 0;
|
||||
goto free_cfg_mem;
|
||||
@ -744,15 +736,12 @@ static int smc_setup(struct pcmcia_device *link)
|
||||
}
|
||||
}
|
||||
/* Try the third string in the Version 1 Version/ID tuple. */
|
||||
tuple->DesiredTuple = CISTPL_VERS_1;
|
||||
if (first_tuple(link, tuple, parse) != CS_SUCCESS) {
|
||||
rc = -1;
|
||||
goto free_cfg_mem;
|
||||
}
|
||||
station_addr = parse->version_1.str + parse->version_1.ofs[2];
|
||||
if (cvt_ascii_address(dev, station_addr) == 0) {
|
||||
rc = 0;
|
||||
goto free_cfg_mem;
|
||||
if (link->prod_id[2]) {
|
||||
station_addr = link->prod_id[2];
|
||||
if (cvt_ascii_address(dev, station_addr) == 0) {
|
||||
rc = 0;
|
||||
goto free_cfg_mem;
|
||||
}
|
||||
}
|
||||
|
||||
rc = -1;
|
||||
@ -970,10 +959,6 @@ static int smc91c92_config(struct pcmcia_device *link)
|
||||
{
|
||||
struct net_device *dev = link->priv;
|
||||
struct smc_private *smc = netdev_priv(dev);
|
||||
struct smc_cfg_mem *cfg_mem;
|
||||
tuple_t *tuple;
|
||||
cisparse_t *parse;
|
||||
u_char *buf;
|
||||
char *name;
|
||||
int i, j, rev;
|
||||
kio_addr_t ioaddr;
|
||||
@ -981,30 +966,8 @@ static int smc91c92_config(struct pcmcia_device *link)
|
||||
|
||||
DEBUG(0, "smc91c92_config(0x%p)\n", link);
|
||||
|
||||
cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL);
|
||||
if (!cfg_mem)
|
||||
goto config_failed;
|
||||
|
||||
tuple = &cfg_mem->tuple;
|
||||
parse = &cfg_mem->parse;
|
||||
buf = cfg_mem->buf;
|
||||
|
||||
tuple->Attributes = tuple->TupleOffset = 0;
|
||||
tuple->TupleData = (cisdata_t *)buf;
|
||||
tuple->TupleDataMax = 64;
|
||||
|
||||
tuple->DesiredTuple = CISTPL_CONFIG;
|
||||
i = first_tuple(link, tuple, parse);
|
||||
CS_EXIT_TEST(i, ParseTuple, config_failed);
|
||||
link->conf.ConfigBase = parse->config.base;
|
||||
link->conf.Present = parse->config.rmask[0];
|
||||
|
||||
tuple->DesiredTuple = CISTPL_MANFID;
|
||||
tuple->Attributes = TUPLE_RETURN_COMMON;
|
||||
if (first_tuple(link, tuple, parse) == CS_SUCCESS) {
|
||||
smc->manfid = parse->manfid.manf;
|
||||
smc->cardid = parse->manfid.card;
|
||||
}
|
||||
smc->manfid = link->manf_id;
|
||||
smc->cardid = link->card_id;
|
||||
|
||||
if ((smc->manfid == MANFID_OSITECH) &&
|
||||
(smc->cardid != PRODID_OSITECH_SEVEN)) {
|
||||
@ -1134,14 +1097,12 @@ static int smc91c92_config(struct pcmcia_device *link)
|
||||
printk(KERN_NOTICE " No MII transceivers found!\n");
|
||||
}
|
||||
}
|
||||
kfree(cfg_mem);
|
||||
return 0;
|
||||
|
||||
config_undo:
|
||||
unregister_netdev(dev);
|
||||
config_failed: /* CS_EXIT_TEST() calls jump to here... */
|
||||
smc91c92_release(link);
|
||||
kfree(cfg_mem);
|
||||
return -ENODEV;
|
||||
} /* smc91c92_config */
|
||||
|
||||
|
@ -707,22 +707,11 @@ set_card_type(struct pcmcia_device *link, const void *s)
|
||||
* Returns: true if this is a CE2
|
||||
*/
|
||||
static int
|
||||
has_ce2_string(struct pcmcia_device * link)
|
||||
has_ce2_string(struct pcmcia_device * p_dev)
|
||||
{
|
||||
tuple_t tuple;
|
||||
cisparse_t parse;
|
||||
u_char buf[256];
|
||||
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = 254;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.DesiredTuple = CISTPL_VERS_1;
|
||||
if (!first_tuple(link, &tuple, &parse) && parse.version_1.ns > 2) {
|
||||
if (strstr(parse.version_1.str + parse.version_1.ofs[2], "CE2"))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
if (p_dev->prod_id[2] && strstr(p_dev->prod_id[2], "CE2"))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************
|
||||
@ -792,13 +781,6 @@ xirc2ps_config(struct pcmcia_device * link)
|
||||
goto failure;
|
||||
}
|
||||
|
||||
/* get configuration stuff */
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
if ((err=first_tuple(link, &tuple, &parse)))
|
||||
goto cis_error;
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
/* get the ethernet address from the CIS */
|
||||
tuple.DesiredTuple = CISTPL_FUNCE;
|
||||
for (err = first_tuple(link, &tuple, &parse); !err;
|
||||
@ -1062,8 +1044,6 @@ xirc2ps_config(struct pcmcia_device * link)
|
||||
xirc2ps_release(link);
|
||||
return -ENODEV;
|
||||
|
||||
cis_error:
|
||||
printk(KNOT_XIRC "unable to parse CIS\n");
|
||||
failure:
|
||||
return -ENODEV;
|
||||
} /* xirc2ps_config */
|
||||
|
@ -219,21 +219,6 @@ static int airo_config(struct pcmcia_device *link)
|
||||
dev = link->priv;
|
||||
|
||||
DEBUG(0, "airo_config(0x%p)\n", link);
|
||||
|
||||
/*
|
||||
This reads the card's CONFIG tuple to find its configuration
|
||||
registers.
|
||||
*/
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
/*
|
||||
In this loop, we scan the CIS for configuration table entries,
|
||||
@ -247,6 +232,10 @@ static int airo_config(struct pcmcia_device *link)
|
||||
these things without consulting the CIS, and most client drivers
|
||||
will only use the CIS to fill in implementation-defined details.
|
||||
*/
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
while (1) {
|
||||
|
@ -243,17 +243,6 @@ static int atmel_config(struct pcmcia_device *link)
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
|
||||
/*
|
||||
This reads the card's CONFIG tuple to find its configuration
|
||||
registers.
|
||||
*/
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
/*
|
||||
In this loop, we scan the CIS for configuration table entries,
|
||||
each of which describes a valid card configuration, including
|
||||
|
@ -293,15 +293,12 @@ static int sandisk_enable_wireless(struct net_device *dev)
|
||||
goto done;
|
||||
}
|
||||
|
||||
tuple.DesiredTuple = CISTPL_MANFID;
|
||||
tuple.Attributes = TUPLE_RETURN_COMMON;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
if (pcmcia_get_first_tuple(hw_priv->link, &tuple) ||
|
||||
pcmcia_get_tuple_data(hw_priv->link, &tuple) ||
|
||||
pcmcia_parse_tuple(hw_priv->link, &tuple, parse) ||
|
||||
parse->manfid.manf != 0xd601 || parse->manfid.card != 0x0101) {
|
||||
|
||||
if (hw_priv->link->manf_id != 0xd601 || hw_priv->link->card_id != 0x0101) {
|
||||
/* No SanDisk manfid found */
|
||||
ret = -ENODEV;
|
||||
goto done;
|
||||
@ -573,16 +570,10 @@ static int prism2_config(struct pcmcia_device *link)
|
||||
}
|
||||
memset(hw_priv, 0, sizeof(*hw_priv));
|
||||
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
|
||||
link->conf.ConfigBase = parse->config.base;
|
||||
link->conf.Present = parse->config.rmask[0];
|
||||
|
||||
CS_CHECK(GetConfigurationInfo,
|
||||
pcmcia_get_configuration_info(link, &conf));
|
||||
|
@ -735,31 +735,13 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
||||
static int netwave_pcmcia_config(struct pcmcia_device *link) {
|
||||
struct net_device *dev = link->priv;
|
||||
netwave_private *priv = netdev_priv(dev);
|
||||
tuple_t tuple;
|
||||
cisparse_t parse;
|
||||
int i, j, last_ret, last_fn;
|
||||
u_char buf[64];
|
||||
win_req_t req;
|
||||
memreq_t mem;
|
||||
u_char __iomem *ramBase = NULL;
|
||||
|
||||
DEBUG(0, "netwave_pcmcia_config(0x%p)\n", link);
|
||||
|
||||
/*
|
||||
This reads the card's CONFIG tuple to find its configuration
|
||||
registers.
|
||||
*/
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = (cisdata_t *) buf;
|
||||
tuple.TupleDataMax = 64;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
/*
|
||||
* Try allocating IO ports. This tries a few fixed addresses.
|
||||
* If you want, you can also read the card's config table to
|
||||
|
@ -178,21 +178,6 @@ orinoco_cs_config(struct pcmcia_device *link)
|
||||
cisparse_t parse;
|
||||
void __iomem *mem;
|
||||
|
||||
/*
|
||||
* This reads the card's CONFIG tuple to find its
|
||||
* configuration registers.
|
||||
*/
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
/* Look up the current Vcc */
|
||||
CS_CHECK(GetConfigurationInfo,
|
||||
pcmcia_get_configuration_info(link, &conf));
|
||||
@ -211,6 +196,10 @@ orinoco_cs_config(struct pcmcia_device *link)
|
||||
* and most client drivers will only use the CIS to fill in
|
||||
* implementation-defined details.
|
||||
*/
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
while (1) {
|
||||
|
@ -408,11 +408,8 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
||||
#define MAX_TUPLE_SIZE 128
|
||||
static int ray_config(struct pcmcia_device *link)
|
||||
{
|
||||
tuple_t tuple;
|
||||
cisparse_t parse;
|
||||
int last_fn = 0, last_ret = 0;
|
||||
int i;
|
||||
u_char buf[MAX_TUPLE_SIZE];
|
||||
win_req_t req;
|
||||
memreq_t mem;
|
||||
struct net_device *dev = (struct net_device *)link->priv;
|
||||
@ -420,29 +417,12 @@ static int ray_config(struct pcmcia_device *link)
|
||||
|
||||
DEBUG(1, "ray_config(0x%p)\n", link);
|
||||
|
||||
/* This reads the card's CONFIG tuple to find its configuration regs */
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = MAX_TUPLE_SIZE;
|
||||
tuple.TupleOffset = 0;
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
/* Determine card type and firmware version */
|
||||
buf[0] = buf[MAX_TUPLE_SIZE - 1] = 0;
|
||||
tuple.DesiredTuple = CISTPL_VERS_1;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = MAX_TUPLE_SIZE;
|
||||
tuple.TupleOffset = 2;
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
|
||||
for (i=0; i<tuple.TupleDataLen - 4; i++)
|
||||
if (buf[i] == 0) buf[i] = ' ';
|
||||
printk(KERN_INFO "ray_cs Detected: %s\n",buf);
|
||||
printk(KERN_INFO "ray_cs Detected: %s%s%s%s\n",
|
||||
link->prod_id[0] ? link->prod_id[0] : " ",
|
||||
link->prod_id[1] ? link->prod_id[1] : " ",
|
||||
link->prod_id[2] ? link->prod_id[2] : " ",
|
||||
link->prod_id[3] ? link->prod_id[3] : " ");
|
||||
|
||||
/* Now allocate an interrupt line. Note that this does not
|
||||
actually assign a handler to the interrupt.
|
||||
|
@ -647,21 +647,6 @@ spectrum_cs_config(struct pcmcia_device *link)
|
||||
cisparse_t parse;
|
||||
void __iomem *mem;
|
||||
|
||||
/*
|
||||
* This reads the card's CONFIG tuple to find its
|
||||
* configuration registers.
|
||||
*/
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
/* Look up the current Vcc */
|
||||
CS_CHECK(GetConfigurationInfo,
|
||||
pcmcia_get_configuration_info(link, &conf));
|
||||
@ -681,6 +666,10 @@ spectrum_cs_config(struct pcmcia_device *link)
|
||||
* implementation-defined details.
|
||||
*/
|
||||
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
while (1) {
|
||||
cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
|
||||
|
@ -3939,11 +3939,8 @@ wv_hw_reset(struct net_device * dev)
|
||||
static inline int
|
||||
wv_pcmcia_config(struct pcmcia_device * link)
|
||||
{
|
||||
tuple_t tuple;
|
||||
cisparse_t parse;
|
||||
struct net_device * dev = (struct net_device *) link->priv;
|
||||
int i;
|
||||
u_char buf[64];
|
||||
win_req_t req;
|
||||
memreq_t mem;
|
||||
net_local * lp = netdev_priv(dev);
|
||||
@ -3953,36 +3950,6 @@ wv_pcmcia_config(struct pcmcia_device * link)
|
||||
printk(KERN_DEBUG "->wv_pcmcia_config(0x%p)\n", link);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This reads the card's CONFIG tuple to find its configuration
|
||||
* registers.
|
||||
*/
|
||||
do
|
||||
{
|
||||
tuple.Attributes = 0;
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
i = pcmcia_get_first_tuple(link, &tuple);
|
||||
if(i != CS_SUCCESS)
|
||||
break;
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleDataMax = 64;
|
||||
tuple.TupleOffset = 0;
|
||||
i = pcmcia_get_tuple_data(link, &tuple);
|
||||
if(i != CS_SUCCESS)
|
||||
break;
|
||||
i = pcmcia_parse_tuple(link, &tuple, &parse);
|
||||
if(i != CS_SUCCESS)
|
||||
break;
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
}
|
||||
while(0);
|
||||
if(i != CS_SUCCESS)
|
||||
{
|
||||
cs_error(link, ParseTuple, i);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
i = pcmcia_request_io(link, &link->io);
|
||||
|
@ -1966,25 +1966,10 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
||||
*/
|
||||
static int wl3501_config(struct pcmcia_device *link)
|
||||
{
|
||||
tuple_t tuple;
|
||||
cisparse_t parse;
|
||||
struct net_device *dev = link->priv;
|
||||
int i = 0, j, last_fn, last_ret;
|
||||
unsigned char bf[64];
|
||||
struct wl3501_card *this;
|
||||
|
||||
/* This reads the card's CONFIG tuple to find its config registers. */
|
||||
tuple.Attributes = 0;
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
tuple.TupleData = bf;
|
||||
tuple.TupleDataMax = sizeof(bf);
|
||||
tuple.TupleOffset = 0;
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
/* Try allocating IO ports. This tries a few fixed addresses. If you
|
||||
* want, you can also read the card's config table to pick addresses --
|
||||
* see the serial driver for an example. */
|
||||
|
@ -166,14 +166,6 @@ static int parport_config(struct pcmcia_device *link)
|
||||
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleOffset = 0; tuple.TupleDataMax = 255;
|
||||
tuple.Attributes = 0;
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
|
||||
tuple.Attributes = 0;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
@ -263,6 +255,7 @@ void parport_cs_release(struct pcmcia_device *link)
|
||||
|
||||
static struct pcmcia_device_id parport_ids[] = {
|
||||
PCMCIA_DEVICE_FUNC_ID(3),
|
||||
PCMCIA_MFC_DEVICE_PROD_ID12(1,"Elan","Serial+Parallel Port: SP230",0x3beb8cf2,0xdb9e58bc),
|
||||
PCMCIA_DEVICE_MANF_CARD(0x0137, 0x0003),
|
||||
PCMCIA_DEVICE_NULL
|
||||
};
|
||||
|
@ -32,10 +32,11 @@
|
||||
* A0..A10 work in each range; A23 indicates I/O space; A25 is CFRNW;
|
||||
* some other bit in {A24,A22..A11} is nREG to flag memory access
|
||||
* (vs attributes). So more than 2KB/region would just be waste.
|
||||
* Note: These are offsets from the physical base address.
|
||||
*/
|
||||
#define CF_ATTR_PHYS (AT91_CF_BASE)
|
||||
#define CF_IO_PHYS (AT91_CF_BASE + (1 << 23))
|
||||
#define CF_MEM_PHYS (AT91_CF_BASE + 0x017ff800)
|
||||
#define CF_ATTR_PHYS (0)
|
||||
#define CF_IO_PHYS (1 << 23)
|
||||
#define CF_MEM_PHYS (0x017ff800)
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
@ -48,6 +49,8 @@ struct at91_cf_socket {
|
||||
|
||||
struct platform_device *pdev;
|
||||
struct at91_cf_data *board;
|
||||
|
||||
unsigned long phys_baseaddr;
|
||||
};
|
||||
|
||||
#define SZ_2K (2 * SZ_1K)
|
||||
@ -154,9 +157,8 @@ static int at91_cf_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io)
|
||||
|
||||
/*
|
||||
* Use 16 bit accesses unless/until we need 8-bit i/o space.
|
||||
* Always set CSR4 ... PCMCIA won't always unmap things.
|
||||
*/
|
||||
csr = at91_sys_read(AT91_SMC_CSR(4)) & ~AT91_SMC_DBW;
|
||||
csr = at91_sys_read(AT91_SMC_CSR(cf->board->chipselect)) & ~AT91_SMC_DBW;
|
||||
|
||||
/*
|
||||
* NOTE: this CF controller ignores IOIS16, so we can't really do
|
||||
@ -168,14 +170,14 @@ static int at91_cf_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io)
|
||||
* some cards only like that way to get at the odd byte, despite
|
||||
* CF 3.0 spec table 35 also giving the D8-D15 option.
|
||||
*/
|
||||
if (!(io->flags & (MAP_16BIT|MAP_AUTOSZ))) {
|
||||
if (!(io->flags & (MAP_16BIT | MAP_AUTOSZ))) {
|
||||
csr |= AT91_SMC_DBW_8;
|
||||
pr_debug("%s: 8bit i/o bus\n", driver_name);
|
||||
} else {
|
||||
csr |= AT91_SMC_DBW_16;
|
||||
pr_debug("%s: 16bit i/o bus\n", driver_name);
|
||||
}
|
||||
at91_sys_write(AT91_SMC_CSR(4), csr);
|
||||
at91_sys_write(AT91_SMC_CSR(cf->board->chipselect), csr);
|
||||
|
||||
io->start = cf->socket.io_offset;
|
||||
io->stop = io->start + SZ_2K - 1;
|
||||
@ -194,11 +196,11 @@ at91_cf_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *map)
|
||||
|
||||
cf = container_of(s, struct at91_cf_socket, socket);
|
||||
|
||||
map->flags &= MAP_ACTIVE|MAP_ATTRIB|MAP_16BIT;
|
||||
map->flags &= (MAP_ACTIVE | MAP_ATTRIB | MAP_16BIT);
|
||||
if (map->flags & MAP_ATTRIB)
|
||||
map->static_start = CF_ATTR_PHYS;
|
||||
map->static_start = cf->phys_baseaddr + CF_ATTR_PHYS;
|
||||
else
|
||||
map->static_start = CF_MEM_PHYS;
|
||||
map->static_start = cf->phys_baseaddr + CF_MEM_PHYS;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -219,7 +221,6 @@ static int __init at91_cf_probe(struct platform_device *pdev)
|
||||
struct at91_cf_socket *cf;
|
||||
struct at91_cf_data *board = pdev->dev.platform_data;
|
||||
struct resource *io;
|
||||
unsigned int csa;
|
||||
int status;
|
||||
|
||||
if (!board || !board->det_pin || !board->rst_pin)
|
||||
@ -235,33 +236,11 @@ static int __init at91_cf_probe(struct platform_device *pdev)
|
||||
|
||||
cf->board = board;
|
||||
cf->pdev = pdev;
|
||||
cf->phys_baseaddr = io->start;
|
||||
platform_set_drvdata(pdev, cf);
|
||||
|
||||
/* CF takes over CS4, CS5, CS6 */
|
||||
csa = at91_sys_read(AT91_EBI_CSA);
|
||||
at91_sys_write(AT91_EBI_CSA, csa | AT91_EBI_CS4A_SMC_COMPACTFLASH);
|
||||
|
||||
/* nWAIT is _not_ a default setting */
|
||||
(void) at91_set_A_periph(AT91_PIN_PC6, 1); /* nWAIT */
|
||||
|
||||
/*
|
||||
* Static memory controller timing adjustments.
|
||||
* REVISIT: these timings are in terms of MCK cycles, so
|
||||
* when MCK changes (cpufreq etc) so must these values...
|
||||
*/
|
||||
at91_sys_write(AT91_SMC_CSR(4),
|
||||
AT91_SMC_ACSS_STD
|
||||
| AT91_SMC_DBW_16
|
||||
| AT91_SMC_BAT
|
||||
| AT91_SMC_WSEN
|
||||
| AT91_SMC_NWS_(32) /* wait states */
|
||||
| AT91_SMC_RWSETUP_(6) /* setup time */
|
||||
| AT91_SMC_RWHOLD_(4) /* hold time */
|
||||
);
|
||||
|
||||
/* must be a GPIO; ergo must trigger on both edges */
|
||||
status = request_irq(board->det_pin, at91_cf_irq,
|
||||
IRQF_SAMPLE_RANDOM, driver_name, cf);
|
||||
status = request_irq(board->det_pin, at91_cf_irq, 0, driver_name, cf);
|
||||
if (status < 0)
|
||||
goto fail0;
|
||||
device_init_wakeup(&pdev->dev, 1);
|
||||
@ -282,14 +261,18 @@ static int __init at91_cf_probe(struct platform_device *pdev)
|
||||
cf->socket.pci_irq = NR_IRQS + 1;
|
||||
|
||||
/* pcmcia layer only remaps "real" memory not iospace */
|
||||
cf->socket.io_offset = (unsigned long) ioremap(CF_IO_PHYS, SZ_2K);
|
||||
if (!cf->socket.io_offset)
|
||||
cf->socket.io_offset = (unsigned long) ioremap(cf->phys_baseaddr + CF_IO_PHYS, SZ_2K);
|
||||
if (!cf->socket.io_offset) {
|
||||
status = -ENXIO;
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
/* reserve CS4, CS5, and CS6 regions; but use just CS4 */
|
||||
/* reserve chip-select regions */
|
||||
if (!request_mem_region(io->start, io->end + 1 - io->start,
|
||||
driver_name))
|
||||
driver_name)) {
|
||||
status = -ENXIO;
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
pr_info("%s: irqs det #%d, io #%d\n", driver_name,
|
||||
board->det_pin, board->irq_pin);
|
||||
@ -319,9 +302,7 @@ fail1:
|
||||
fail0a:
|
||||
device_init_wakeup(&pdev->dev, 0);
|
||||
free_irq(board->det_pin, cf);
|
||||
device_init_wakeup(&pdev->dev, 0);
|
||||
fail0:
|
||||
at91_sys_write(AT91_EBI_CSA, csa);
|
||||
kfree(cf);
|
||||
return status;
|
||||
}
|
||||
@ -331,19 +312,15 @@ static int __exit at91_cf_remove(struct platform_device *pdev)
|
||||
struct at91_cf_socket *cf = platform_get_drvdata(pdev);
|
||||
struct at91_cf_data *board = cf->board;
|
||||
struct resource *io = cf->socket.io[0].res;
|
||||
unsigned int csa;
|
||||
|
||||
pcmcia_unregister_socket(&cf->socket);
|
||||
if (board->irq_pin)
|
||||
free_irq(board->irq_pin, cf);
|
||||
free_irq(board->det_pin, cf);
|
||||
device_init_wakeup(&pdev->dev, 0);
|
||||
free_irq(board->det_pin, cf);
|
||||
iounmap((void __iomem *) cf->socket.io_offset);
|
||||
release_mem_region(io->start, io->end + 1 - io->start);
|
||||
|
||||
csa = at91_sys_read(AT91_EBI_CSA);
|
||||
at91_sys_write(AT91_EBI_CSA, csa & ~AT91_EBI_CS4A);
|
||||
|
||||
kfree(cf);
|
||||
return 0;
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ int pccard_get_status(struct pcmcia_socket *s, struct pcmcia_device *p_dev, cs_s
|
||||
struct pcmcia_callback{
|
||||
struct module *owner;
|
||||
int (*event) (struct pcmcia_socket *s, event_t event, int priority);
|
||||
void (*requery) (struct pcmcia_socket *s);
|
||||
void (*requery) (struct pcmcia_socket *s, int new_cis);
|
||||
int (*suspend) (struct pcmcia_socket *s);
|
||||
int (*resume) (struct pcmcia_socket *s);
|
||||
};
|
||||
|
@ -231,65 +231,6 @@ static void pcmcia_check_driver(struct pcmcia_driver *p_drv)
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_PCMCIA_LOAD_CIS
|
||||
|
||||
/**
|
||||
* pcmcia_load_firmware - load CIS from userspace if device-provided is broken
|
||||
* @dev - the pcmcia device which needs a CIS override
|
||||
* @filename - requested filename in /lib/firmware/
|
||||
*
|
||||
* This uses the in-kernel firmware loading mechanism to use a "fake CIS" if
|
||||
* the one provided by the card is broken. The firmware files reside in
|
||||
* /lib/firmware/ in userspace.
|
||||
*/
|
||||
static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename)
|
||||
{
|
||||
struct pcmcia_socket *s = dev->socket;
|
||||
const struct firmware *fw;
|
||||
char path[20];
|
||||
int ret=-ENOMEM;
|
||||
cisdump_t *cis;
|
||||
|
||||
if (!filename)
|
||||
return -EINVAL;
|
||||
|
||||
ds_dbg(1, "trying to load firmware %s\n", filename);
|
||||
|
||||
if (strlen(filename) > 14)
|
||||
return -EINVAL;
|
||||
|
||||
snprintf(path, 20, "%s", filename);
|
||||
|
||||
if (request_firmware(&fw, path, &dev->dev) == 0) {
|
||||
if (fw->size >= CISTPL_MAX_CIS_SIZE)
|
||||
goto release;
|
||||
|
||||
cis = kzalloc(sizeof(cisdump_t), GFP_KERNEL);
|
||||
if (!cis)
|
||||
goto release;
|
||||
|
||||
cis->Length = fw->size + 1;
|
||||
memcpy(cis->Data, fw->data, fw->size);
|
||||
|
||||
if (!pcmcia_replace_cis(s, cis))
|
||||
ret = 0;
|
||||
}
|
||||
release:
|
||||
release_firmware(fw);
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#else /* !CONFIG_PCMCIA_LOAD_CIS */
|
||||
|
||||
static inline int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*======================================================================*/
|
||||
|
||||
|
||||
@ -309,6 +250,8 @@ int pcmcia_register_driver(struct pcmcia_driver *driver)
|
||||
driver->drv.bus = &pcmcia_bus_type;
|
||||
driver->drv.owner = driver->owner;
|
||||
|
||||
ds_dbg(3, "registering driver %s\n", driver->drv.name);
|
||||
|
||||
return driver_register(&driver->drv);
|
||||
}
|
||||
EXPORT_SYMBOL(pcmcia_register_driver);
|
||||
@ -318,6 +261,7 @@ EXPORT_SYMBOL(pcmcia_register_driver);
|
||||
*/
|
||||
void pcmcia_unregister_driver(struct pcmcia_driver *driver)
|
||||
{
|
||||
ds_dbg(3, "unregistering driver %s\n", driver->drv.name);
|
||||
driver_unregister(&driver->drv);
|
||||
}
|
||||
EXPORT_SYMBOL(pcmcia_unregister_driver);
|
||||
@ -343,23 +287,27 @@ void pcmcia_put_dev(struct pcmcia_device *p_dev)
|
||||
static void pcmcia_release_function(struct kref *ref)
|
||||
{
|
||||
struct config_t *c = container_of(ref, struct config_t, ref);
|
||||
ds_dbg(1, "releasing config_t\n");
|
||||
kfree(c);
|
||||
}
|
||||
|
||||
static void pcmcia_release_dev(struct device *dev)
|
||||
{
|
||||
struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
|
||||
ds_dbg(1, "releasing dev %p\n", p_dev);
|
||||
ds_dbg(1, "releasing device %s\n", p_dev->dev.bus_id);
|
||||
pcmcia_put_socket(p_dev->socket);
|
||||
kfree(p_dev->devname);
|
||||
kref_put(&p_dev->function_config->ref, pcmcia_release_function);
|
||||
kfree(p_dev);
|
||||
}
|
||||
|
||||
static void pcmcia_add_pseudo_device(struct pcmcia_socket *s)
|
||||
static void pcmcia_add_device_later(struct pcmcia_socket *s, int mfc)
|
||||
{
|
||||
if (!s->pcmcia_state.device_add_pending) {
|
||||
ds_dbg(1, "scheduling to add %s secondary"
|
||||
" device to %d\n", mfc ? "mfc" : "pfc", s->sock);
|
||||
s->pcmcia_state.device_add_pending = 1;
|
||||
s->pcmcia_state.mfc_pfc = mfc;
|
||||
schedule_work(&s->device_add);
|
||||
}
|
||||
return;
|
||||
@ -371,6 +319,7 @@ static int pcmcia_device_probe(struct device * dev)
|
||||
struct pcmcia_driver *p_drv;
|
||||
struct pcmcia_device_id *did;
|
||||
struct pcmcia_socket *s;
|
||||
cistpl_config_t cis_config;
|
||||
int ret = 0;
|
||||
|
||||
dev = get_device(dev);
|
||||
@ -381,15 +330,33 @@ static int pcmcia_device_probe(struct device * dev)
|
||||
p_drv = to_pcmcia_drv(dev->driver);
|
||||
s = p_dev->socket;
|
||||
|
||||
ds_dbg(1, "trying to bind %s to %s\n", p_dev->dev.bus_id,
|
||||
p_drv->drv.name);
|
||||
|
||||
if ((!p_drv->probe) || (!p_dev->function_config) ||
|
||||
(!try_module_get(p_drv->owner))) {
|
||||
ret = -EINVAL;
|
||||
goto put_dev;
|
||||
}
|
||||
|
||||
/* set up some more device information */
|
||||
ret = pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_CONFIG,
|
||||
&cis_config);
|
||||
if (!ret) {
|
||||
p_dev->conf.ConfigBase = cis_config.base;
|
||||
p_dev->conf.Present = cis_config.rmask[0];
|
||||
} else {
|
||||
printk(KERN_INFO "pcmcia: could not parse base and rmask0 of CIS\n");
|
||||
p_dev->conf.ConfigBase = 0;
|
||||
p_dev->conf.Present = 0;
|
||||
}
|
||||
|
||||
ret = p_drv->probe(p_dev);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
ds_dbg(1, "binding %s to %s failed with %d\n",
|
||||
p_dev->dev.bus_id, p_drv->drv.name, ret);
|
||||
goto put_module;
|
||||
}
|
||||
|
||||
/* handle pseudo multifunction devices:
|
||||
* there are at most two pseudo multifunction devices.
|
||||
@ -400,7 +367,7 @@ static int pcmcia_device_probe(struct device * dev)
|
||||
did = p_dev->dev.driver_data;
|
||||
if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) &&
|
||||
(p_dev->socket->device_count == 1) && (p_dev->device_no == 0))
|
||||
pcmcia_add_pseudo_device(p_dev->socket);
|
||||
pcmcia_add_device_later(p_dev->socket, 0);
|
||||
|
||||
put_module:
|
||||
if (ret)
|
||||
@ -421,8 +388,8 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le
|
||||
struct pcmcia_device *tmp;
|
||||
unsigned long flags;
|
||||
|
||||
ds_dbg(2, "unbind_request(%d)\n", s->sock);
|
||||
|
||||
ds_dbg(2, "pcmcia_card_remove(%d) %s\n", s->sock,
|
||||
leftover ? leftover->devname : "");
|
||||
|
||||
if (!leftover)
|
||||
s->device_count = 0;
|
||||
@ -439,6 +406,7 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le
|
||||
p_dev->_removed=1;
|
||||
spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
|
||||
|
||||
ds_dbg(2, "unregistering device %s\n", p_dev->dev.bus_id);
|
||||
device_unregister(&p_dev->dev);
|
||||
}
|
||||
|
||||
@ -455,6 +423,8 @@ static int pcmcia_device_remove(struct device * dev)
|
||||
p_dev = to_pcmcia_dev(dev);
|
||||
p_drv = to_pcmcia_drv(dev->driver);
|
||||
|
||||
ds_dbg(1, "removing device %s\n", p_dev->dev.bus_id);
|
||||
|
||||
/* If we're removing the primary module driving a
|
||||
* pseudo multi-function card, we need to unbind
|
||||
* all devices
|
||||
@ -587,8 +557,10 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
|
||||
|
||||
mutex_lock(&device_add_lock);
|
||||
|
||||
/* max of 2 devices per card */
|
||||
if (s->device_count == 2)
|
||||
ds_dbg(3, "adding device to %d, function %d\n", s->sock, function);
|
||||
|
||||
/* max of 4 devices per card */
|
||||
if (s->device_count == 4)
|
||||
goto err_put;
|
||||
|
||||
p_dev = kzalloc(sizeof(struct pcmcia_device), GFP_KERNEL);
|
||||
@ -598,8 +570,6 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
|
||||
p_dev->socket = s;
|
||||
p_dev->device_no = (s->device_count++);
|
||||
p_dev->func = function;
|
||||
if (s->functions <= function)
|
||||
s->functions = function + 1;
|
||||
|
||||
p_dev->dev.bus = &pcmcia_bus_type;
|
||||
p_dev->dev.parent = s->dev.dev;
|
||||
@ -610,8 +580,8 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
|
||||
if (!p_dev->devname)
|
||||
goto err_free;
|
||||
sprintf (p_dev->devname, "pcmcia%s", p_dev->dev.bus_id);
|
||||
ds_dbg(3, "devname is %s\n", p_dev->devname);
|
||||
|
||||
/* compat */
|
||||
spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
|
||||
|
||||
/*
|
||||
@ -631,6 +601,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
|
||||
spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
|
||||
|
||||
if (!p_dev->function_config) {
|
||||
ds_dbg(3, "creating config_t for %s\n", p_dev->dev.bus_id);
|
||||
p_dev->function_config = kzalloc(sizeof(struct config_t),
|
||||
GFP_KERNEL);
|
||||
if (!p_dev->function_config)
|
||||
@ -674,11 +645,16 @@ static int pcmcia_card_add(struct pcmcia_socket *s)
|
||||
unsigned int no_funcs, i;
|
||||
int ret = 0;
|
||||
|
||||
if (!(s->resource_setup_done))
|
||||
if (!(s->resource_setup_done)) {
|
||||
ds_dbg(3, "no resources available, delaying card_add\n");
|
||||
return -EAGAIN; /* try again, but later... */
|
||||
}
|
||||
|
||||
if (pcmcia_validate_mem(s))
|
||||
if (pcmcia_validate_mem(s)) {
|
||||
ds_dbg(3, "validating mem resources failed, "
|
||||
"delaying card_add\n");
|
||||
return -EAGAIN; /* try again, but later... */
|
||||
}
|
||||
|
||||
ret = pccard_validate_cis(s, BIND_FN_ALL, &cisinfo);
|
||||
if (ret || !cisinfo.Chains) {
|
||||
@ -690,6 +666,7 @@ static int pcmcia_card_add(struct pcmcia_socket *s)
|
||||
no_funcs = mfc.nfn;
|
||||
else
|
||||
no_funcs = 1;
|
||||
s->functions = no_funcs;
|
||||
|
||||
for (i=0; i < no_funcs; i++)
|
||||
pcmcia_device_add(s, i);
|
||||
@ -698,38 +675,49 @@ static int pcmcia_card_add(struct pcmcia_socket *s)
|
||||
}
|
||||
|
||||
|
||||
static void pcmcia_delayed_add_pseudo_device(void *data)
|
||||
static void pcmcia_delayed_add_device(void *data)
|
||||
{
|
||||
struct pcmcia_socket *s = data;
|
||||
pcmcia_device_add(s, 0);
|
||||
ds_dbg(1, "adding additional device to %d\n", s->sock);
|
||||
pcmcia_device_add(s, s->pcmcia_state.mfc_pfc);
|
||||
s->pcmcia_state.device_add_pending = 0;
|
||||
s->pcmcia_state.mfc_pfc = 0;
|
||||
}
|
||||
|
||||
static int pcmcia_requery(struct device *dev, void * _data)
|
||||
{
|
||||
struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
|
||||
if (!p_dev->dev.driver)
|
||||
if (!p_dev->dev.driver) {
|
||||
ds_dbg(1, "update device information for %s\n",
|
||||
p_dev->dev.bus_id);
|
||||
pcmcia_device_query(p_dev);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void pcmcia_bus_rescan(struct pcmcia_socket *skt)
|
||||
static void pcmcia_bus_rescan(struct pcmcia_socket *skt, int new_cis)
|
||||
{
|
||||
int no_devices=0;
|
||||
int no_devices = 0;
|
||||
int ret = 0;
|
||||
unsigned long flags;
|
||||
|
||||
/* must be called with skt_mutex held */
|
||||
ds_dbg(0, "re-scanning socket %d\n", skt->sock);
|
||||
|
||||
spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
|
||||
if (list_empty(&skt->devices_list))
|
||||
no_devices=1;
|
||||
no_devices = 1;
|
||||
spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
|
||||
|
||||
/* If this is because of a CIS override, start over */
|
||||
if (new_cis && !no_devices)
|
||||
pcmcia_card_remove(skt, NULL);
|
||||
|
||||
/* if no devices were added for this socket yet because of
|
||||
* missing resource information or other trouble, we need to
|
||||
* do this now. */
|
||||
if (no_devices) {
|
||||
if (no_devices || new_cis) {
|
||||
ret = pcmcia_card_add(skt);
|
||||
if (ret)
|
||||
return;
|
||||
@ -747,6 +735,97 @@ static void pcmcia_bus_rescan(struct pcmcia_socket *skt)
|
||||
printk(KERN_INFO "pcmcia: bus_rescan_devices failed\n");
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PCMCIA_LOAD_CIS
|
||||
|
||||
/**
|
||||
* pcmcia_load_firmware - load CIS from userspace if device-provided is broken
|
||||
* @dev - the pcmcia device which needs a CIS override
|
||||
* @filename - requested filename in /lib/firmware/
|
||||
*
|
||||
* This uses the in-kernel firmware loading mechanism to use a "fake CIS" if
|
||||
* the one provided by the card is broken. The firmware files reside in
|
||||
* /lib/firmware/ in userspace.
|
||||
*/
|
||||
static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename)
|
||||
{
|
||||
struct pcmcia_socket *s = dev->socket;
|
||||
const struct firmware *fw;
|
||||
char path[20];
|
||||
int ret = -ENOMEM;
|
||||
int no_funcs;
|
||||
int old_funcs;
|
||||
cisdump_t *cis;
|
||||
cistpl_longlink_mfc_t mfc;
|
||||
|
||||
if (!filename)
|
||||
return -EINVAL;
|
||||
|
||||
ds_dbg(1, "trying to load CIS file %s\n", filename);
|
||||
|
||||
if (strlen(filename) > 14) {
|
||||
printk(KERN_WARNING "pcmcia: CIS filename is too long\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
snprintf(path, 20, "%s", filename);
|
||||
|
||||
if (request_firmware(&fw, path, &dev->dev) == 0) {
|
||||
if (fw->size >= CISTPL_MAX_CIS_SIZE) {
|
||||
ret = -EINVAL;
|
||||
printk(KERN_ERR "pcmcia: CIS override is too big\n");
|
||||
goto release;
|
||||
}
|
||||
|
||||
cis = kzalloc(sizeof(cisdump_t), GFP_KERNEL);
|
||||
if (!cis) {
|
||||
ret = -ENOMEM;
|
||||
goto release;
|
||||
}
|
||||
|
||||
cis->Length = fw->size + 1;
|
||||
memcpy(cis->Data, fw->data, fw->size);
|
||||
|
||||
if (!pcmcia_replace_cis(s, cis))
|
||||
ret = 0;
|
||||
else {
|
||||
printk(KERN_ERR "pcmcia: CIS override failed\n");
|
||||
goto release;
|
||||
}
|
||||
|
||||
|
||||
/* update information */
|
||||
pcmcia_device_query(dev);
|
||||
|
||||
/* does this cis override add or remove functions? */
|
||||
old_funcs = s->functions;
|
||||
|
||||
if (!pccard_read_tuple(s, BIND_FN_ALL, CISTPL_LONGLINK_MFC, &mfc))
|
||||
no_funcs = mfc.nfn;
|
||||
else
|
||||
no_funcs = 1;
|
||||
s->functions = no_funcs;
|
||||
|
||||
if (old_funcs > no_funcs)
|
||||
pcmcia_card_remove(s, dev);
|
||||
else if (no_funcs > old_funcs)
|
||||
pcmcia_add_device_later(s, 1);
|
||||
}
|
||||
release:
|
||||
release_firmware(fw);
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#else /* !CONFIG_PCMCIA_LOAD_CIS */
|
||||
|
||||
static inline int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static inline int pcmcia_devmatch(struct pcmcia_device *dev,
|
||||
struct pcmcia_device_id *did)
|
||||
{
|
||||
@ -813,11 +892,14 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,
|
||||
* after it has re-checked that there is no possible module
|
||||
* with a prod_id/manf_id/card_id match.
|
||||
*/
|
||||
ds_dbg(0, "skipping FUNC_ID match for %s until userspace "
|
||||
"interaction\n", dev->dev.bus_id);
|
||||
if (!dev->allow_func_id_match)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) {
|
||||
ds_dbg(0, "device %s needs a fake CIS\n", dev->dev.bus_id);
|
||||
if (!dev->socket->fake_cis)
|
||||
pcmcia_load_firmware(dev, did->cisfile);
|
||||
|
||||
@ -847,13 +929,21 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) {
|
||||
|
||||
#ifdef CONFIG_PCMCIA_IOCTL
|
||||
/* matching by cardmgr */
|
||||
if (p_dev->cardmgr == p_drv)
|
||||
if (p_dev->cardmgr == p_drv) {
|
||||
ds_dbg(0, "cardmgr matched %s to %s\n", dev->bus_id,
|
||||
drv->name);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
while (did && did->match_flags) {
|
||||
if (pcmcia_devmatch(p_dev, did))
|
||||
ds_dbg(3, "trying to match %s to %s\n", dev->bus_id,
|
||||
drv->name);
|
||||
if (pcmcia_devmatch(p_dev, did)) {
|
||||
ds_dbg(0, "matched %s to %s\n", dev->bus_id,
|
||||
drv->name);
|
||||
return 1;
|
||||
}
|
||||
did++;
|
||||
}
|
||||
|
||||
@ -1044,6 +1134,8 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state)
|
||||
struct pcmcia_driver *p_drv = NULL;
|
||||
int ret = 0;
|
||||
|
||||
ds_dbg(2, "suspending %s\n", dev->bus_id);
|
||||
|
||||
if (dev->driver)
|
||||
p_drv = to_pcmcia_drv(dev->driver);
|
||||
|
||||
@ -1052,12 +1144,18 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state)
|
||||
|
||||
if (p_drv->suspend) {
|
||||
ret = p_drv->suspend(p_dev);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
printk(KERN_ERR "pcmcia: device %s (driver %s) did "
|
||||
"not want to go to sleep (%d)\n",
|
||||
p_dev->devname, p_drv->drv.name, ret);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (p_dev->device_no == p_dev->func)
|
||||
if (p_dev->device_no == p_dev->func) {
|
||||
ds_dbg(2, "releasing configuration for %s\n", dev->bus_id);
|
||||
pcmcia_release_configuration(p_dev);
|
||||
}
|
||||
|
||||
out:
|
||||
if (!ret)
|
||||
@ -1072,6 +1170,8 @@ static int pcmcia_dev_resume(struct device * dev)
|
||||
struct pcmcia_driver *p_drv = NULL;
|
||||
int ret = 0;
|
||||
|
||||
ds_dbg(2, "resuming %s\n", dev->bus_id);
|
||||
|
||||
if (dev->driver)
|
||||
p_drv = to_pcmcia_drv(dev->driver);
|
||||
|
||||
@ -1079,6 +1179,7 @@ static int pcmcia_dev_resume(struct device * dev)
|
||||
goto out;
|
||||
|
||||
if (p_dev->device_no == p_dev->func) {
|
||||
ds_dbg(2, "requesting configuration for %s\n", dev->bus_id);
|
||||
ret = pcmcia_request_configuration(p_dev, &p_dev->conf);
|
||||
if (ret)
|
||||
goto out;
|
||||
@ -1120,12 +1221,14 @@ static int pcmcia_bus_resume_callback(struct device *dev, void * _data)
|
||||
|
||||
static int pcmcia_bus_resume(struct pcmcia_socket *skt)
|
||||
{
|
||||
ds_dbg(2, "resuming socket %d\n", skt->sock);
|
||||
bus_for_each_dev(&pcmcia_bus_type, NULL, skt, pcmcia_bus_resume_callback);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pcmcia_bus_suspend(struct pcmcia_socket *skt)
|
||||
{
|
||||
ds_dbg(2, "suspending socket %d\n", skt->sock);
|
||||
if (bus_for_each_dev(&pcmcia_bus_type, NULL, skt,
|
||||
pcmcia_bus_suspend_callback)) {
|
||||
pcmcia_bus_resume(skt);
|
||||
@ -1246,7 +1349,7 @@ static int __devinit pcmcia_bus_add_socket(struct class_device *class_dev,
|
||||
init_waitqueue_head(&socket->queue);
|
||||
#endif
|
||||
INIT_LIST_HEAD(&socket->devices_list);
|
||||
INIT_WORK(&socket->device_add, pcmcia_delayed_add_pseudo_device, socket);
|
||||
INIT_WORK(&socket->device_add, pcmcia_delayed_add_device, socket);
|
||||
memset(&socket->pcmcia_state, 0, sizeof(u8));
|
||||
socket->device_count = 0;
|
||||
|
||||
|
@ -398,7 +398,7 @@ static irqreturn_t pcc_interrupt(int irq, void *dev)
|
||||
static void pcc_interrupt_wrapper(u_long data)
|
||||
{
|
||||
debug(3, "m32r_cfc: pcc_interrupt_wrapper:\n");
|
||||
pcc_interrupt(0, NULL, NULL);
|
||||
pcc_interrupt(0, NULL);
|
||||
init_timer(&poll_timer);
|
||||
poll_timer.expires = jiffies + poll_interval;
|
||||
add_timer(&poll_timer);
|
||||
|
@ -594,7 +594,12 @@ static int ds_ioctl(struct inode * inode, struct file * file,
|
||||
|
||||
err = ret = 0;
|
||||
|
||||
if (cmd & IOC_IN) __copy_from_user((char *)buf, uarg, size);
|
||||
if (cmd & IOC_IN) {
|
||||
if (__copy_from_user((char *)buf, uarg, size)) {
|
||||
err = -EFAULT;
|
||||
goto free_out;
|
||||
}
|
||||
}
|
||||
|
||||
switch (cmd) {
|
||||
case DS_ADJUST_RESOURCE_INFO:
|
||||
|
@ -581,10 +581,10 @@ static irqreturn_t pd6729_test(int irq, void *dev)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static int pd6729_check_irq(int irq, int flags)
|
||||
static int pd6729_check_irq(int irq)
|
||||
{
|
||||
if (request_irq(irq, pd6729_test, flags, "x", pd6729_test) != 0)
|
||||
return -1;
|
||||
if (request_irq(irq, pd6729_test, IRQF_PROBE_SHARED, "x", pd6729_test)
|
||||
!= 0) return -1;
|
||||
free_irq(irq, pd6729_test);
|
||||
return 0;
|
||||
}
|
||||
@ -610,7 +610,7 @@ static u_int __devinit pd6729_isa_scan(void)
|
||||
|
||||
/* just find interrupts that aren't in use */
|
||||
for (i = 0; i < 16; i++)
|
||||
if ((mask0 & (1 << i)) && (pd6729_check_irq(i, 0) == 0))
|
||||
if ((mask0 & (1 << i)) && (pd6729_check_irq(i) == 0))
|
||||
mask |= (1 << i);
|
||||
|
||||
printk(KERN_INFO "pd6729: ISA irqs = ");
|
||||
|
@ -188,7 +188,7 @@ static ssize_t pccard_store_resource(struct class_device *dev, const char *buf,
|
||||
(s->state & SOCKET_PRESENT) &&
|
||||
!(s->state & SOCKET_CARDBUS)) {
|
||||
if (try_module_get(s->callback->owner)) {
|
||||
s->callback->requery(s);
|
||||
s->callback->requery(s, 0);
|
||||
module_put(s->callback->owner);
|
||||
}
|
||||
}
|
||||
@ -325,7 +325,7 @@ static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, siz
|
||||
if ((s->callback) && (s->state & SOCKET_PRESENT) &&
|
||||
!(s->state & SOCKET_CARDBUS)) {
|
||||
if (try_module_get(s->callback->owner)) {
|
||||
s->callback->requery(s);
|
||||
s->callback->requery(s, 1);
|
||||
module_put(s->callback->owner);
|
||||
}
|
||||
}
|
||||
|
@ -154,16 +154,11 @@ static int aha152x_config_cs(struct pcmcia_device *link)
|
||||
|
||||
DEBUG(0, "aha152x_config(0x%p)\n", link);
|
||||
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
tuple.TupleData = tuple_data;
|
||||
tuple.TupleDataMax = 64;
|
||||
tuple.TupleOffset = 0;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
|
||||
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
|
||||
tuple.Attributes = 0;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
while (1) {
|
||||
if (pcmcia_get_tuple_data(link, &tuple) != 0 ||
|
||||
|
@ -136,14 +136,9 @@ static int fdomain_config(struct pcmcia_device *link)
|
||||
|
||||
DEBUG(0, "fdomain_config(0x%p)\n", link);
|
||||
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
tuple.TupleData = tuple_data;
|
||||
tuple.TupleDataMax = 64;
|
||||
tuple.TupleOffset = 0;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
|
||||
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
|
@ -1685,16 +1685,10 @@ static int nsp_cs_config(struct pcmcia_device *link)
|
||||
|
||||
nsp_dbg(NSP_DEBUG_INIT, "in");
|
||||
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = tuple_data;
|
||||
tuple.TupleDataMax = sizeof(tuple_data);
|
||||
tuple.TupleOffset = 0;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
/* Look up the current Vcc */
|
||||
CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &conf));
|
||||
|
@ -208,18 +208,11 @@ static int qlogic_config(struct pcmcia_device * link)
|
||||
|
||||
DEBUG(0, "qlogic_config(0x%p)\n", link);
|
||||
|
||||
info->manf_id = link->manf_id;
|
||||
|
||||
tuple.TupleData = (cisdata_t *) tuple_data;
|
||||
tuple.TupleDataMax = 64;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
|
||||
tuple.DesiredTuple = CISTPL_MANFID;
|
||||
if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) && (pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS))
|
||||
info->manf_id = le16_to_cpu(tuple.TupleData[0]);
|
||||
|
||||
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
|
@ -722,19 +722,11 @@ SYM53C500_config(struct pcmcia_device *link)
|
||||
|
||||
DEBUG(0, "SYM53C500_config(0x%p)\n", link);
|
||||
|
||||
info->manf_id = link->manf_id;
|
||||
|
||||
tuple.TupleData = (cisdata_t *)tuple_data;
|
||||
tuple.TupleDataMax = 64;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
|
||||
tuple.DesiredTuple = CISTPL_MANFID;
|
||||
if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) &&
|
||||
(pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS))
|
||||
info->manf_id = le16_to_cpu(tuple.TupleData[0]);
|
||||
|
||||
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
|
@ -723,7 +723,7 @@ static int serial_config(struct pcmcia_device * link)
|
||||
u_char *buf;
|
||||
cisparse_t *parse;
|
||||
cistpl_cftable_entry_t *cf;
|
||||
int i, last_ret, last_fn;
|
||||
int i;
|
||||
|
||||
DEBUG(0, "serial_config(0x%p)\n", link);
|
||||
|
||||
@ -740,15 +740,6 @@ static int serial_config(struct pcmcia_device * link)
|
||||
tuple->TupleOffset = 0;
|
||||
tuple->TupleDataMax = 255;
|
||||
tuple->Attributes = 0;
|
||||
/* Get configuration register information */
|
||||
tuple->DesiredTuple = CISTPL_CONFIG;
|
||||
last_ret = first_tuple(link, tuple, parse);
|
||||
if (last_ret != CS_SUCCESS) {
|
||||
last_fn = ParseTuple;
|
||||
goto cs_failed;
|
||||
}
|
||||
link->conf.ConfigBase = parse->config.base;
|
||||
link->conf.Present = parse->config.rmask[0];
|
||||
|
||||
/* Is this a compliant multifunction card? */
|
||||
tuple->DesiredTuple = CISTPL_LONGLINK_MFC;
|
||||
@ -757,27 +748,25 @@ static int serial_config(struct pcmcia_device * link)
|
||||
|
||||
/* Is this a multiport card? */
|
||||
tuple->DesiredTuple = CISTPL_MANFID;
|
||||
if (first_tuple(link, tuple, parse) == CS_SUCCESS) {
|
||||
info->manfid = parse->manfid.manf;
|
||||
info->prodid = parse->manfid.card;
|
||||
info->manfid = link->manf_id;
|
||||
info->prodid = link->card_id;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(quirks); i++)
|
||||
if ((quirks[i].manfid == ~0 ||
|
||||
quirks[i].manfid == info->manfid) &&
|
||||
(quirks[i].prodid == ~0 ||
|
||||
quirks[i].prodid == info->prodid)) {
|
||||
info->quirk = &quirks[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < ARRAY_SIZE(quirks); i++)
|
||||
if ((quirks[i].manfid == ~0 ||
|
||||
quirks[i].manfid == info->manfid) &&
|
||||
(quirks[i].prodid == ~0 ||
|
||||
quirks[i].prodid == info->prodid)) {
|
||||
info->quirk = &quirks[i];
|
||||
break;
|
||||
}
|
||||
|
||||
/* Another check for dual-serial cards: look for either serial or
|
||||
multifunction cards that ask for appropriate IO port ranges */
|
||||
tuple->DesiredTuple = CISTPL_FUNCID;
|
||||
if ((info->multi == 0) &&
|
||||
((first_tuple(link, tuple, parse) != CS_SUCCESS) ||
|
||||
(parse->funcid.func == CISTPL_FUNCID_MULTI) ||
|
||||
(parse->funcid.func == CISTPL_FUNCID_SERIAL))) {
|
||||
(link->has_func_id) &&
|
||||
((link->func_id == CISTPL_FUNCID_MULTI) ||
|
||||
(link->func_id == CISTPL_FUNCID_SERIAL))) {
|
||||
tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY;
|
||||
if (first_tuple(link, tuple, parse) == CS_SUCCESS) {
|
||||
if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0))
|
||||
@ -814,8 +803,6 @@ static int serial_config(struct pcmcia_device * link)
|
||||
kfree(cfg_mem);
|
||||
return 0;
|
||||
|
||||
cs_failed:
|
||||
cs_error(link, last_fn, last_ret);
|
||||
failed:
|
||||
serial_remove(link);
|
||||
kfree(cfg_mem);
|
||||
@ -925,6 +912,30 @@ static struct pcmcia_device_id serial_ids[] = {
|
||||
PCMCIA_DEVICE_CIS_PROD_ID123("ADVANTECH", "COMpad-32/85", "1.0", 0x96913a85, 0x8fbe92ae, 0x0877b627, "COMpad2.cis"),
|
||||
PCMCIA_DEVICE_CIS_PROD_ID2("RS-COM 2P", 0xad20b156, "RS-COM-2P.cis"),
|
||||
PCMCIA_DEVICE_CIS_MANF_CARD(0x0013, 0x0000, "GLOBETROTTER.cis"),
|
||||
PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL100 1.00.",0x19ca78af,0xf964f42b),
|
||||
PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL100",0x19ca78af,0x71d98e83),
|
||||
PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL232 1.00.",0x19ca78af,0x69fb7490),
|
||||
PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL232",0x19ca78af,0xb6bc0235),
|
||||
PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c2000.","SERIAL CARD: CF232",0x63f2e0bd,0xb9e175d3),
|
||||
PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c2000.","SERIAL CARD: CF232-5",0x63f2e0bd,0xfce33442),
|
||||
PCMCIA_DEVICE_PROD_ID12("Elan","Serial Port: CF232",0x3beb8cf2,0x171e7190),
|
||||
PCMCIA_DEVICE_PROD_ID12("Elan","Serial Port: CF232-5",0x3beb8cf2,0x20da4262),
|
||||
PCMCIA_DEVICE_PROD_ID12("Elan","Serial Port: CF428",0x3beb8cf2,0xea5dd57d),
|
||||
PCMCIA_DEVICE_PROD_ID12("Elan","Serial Port: CF500",0x3beb8cf2,0xd77255fa),
|
||||
PCMCIA_DEVICE_PROD_ID12("Elan","Serial Port: IC232",0x3beb8cf2,0x6a709903),
|
||||
PCMCIA_DEVICE_PROD_ID12("Elan","Serial Port: SL232",0x3beb8cf2,0x18430676),
|
||||
PCMCIA_DEVICE_PROD_ID12("Elan","Serial Port: XL232",0x3beb8cf2,0x6f933767),
|
||||
PCMCIA_MFC_DEVICE_PROD_ID12(0,"Elan","Serial Port: CF332",0x3beb8cf2,0x16dc1ba7),
|
||||
PCMCIA_MFC_DEVICE_PROD_ID12(0,"Elan","Serial Port: SL332",0x3beb8cf2,0x19816c41),
|
||||
PCMCIA_MFC_DEVICE_PROD_ID12(0,"Elan","Serial Port: SL385",0x3beb8cf2,0x64112029),
|
||||
PCMCIA_MFC_DEVICE_PROD_ID12(0,"Elan","Serial Port: SL432",0x3beb8cf2,0x1cce7ac4),
|
||||
PCMCIA_MFC_DEVICE_PROD_ID12(0,"Elan","Serial+Parallel Port: SP230",0x3beb8cf2,0xdb9e58bc),
|
||||
PCMCIA_MFC_DEVICE_PROD_ID12(1,"Elan","Serial Port: CF332",0x3beb8cf2,0x16dc1ba7),
|
||||
PCMCIA_MFC_DEVICE_PROD_ID12(1,"Elan","Serial Port: SL332",0x3beb8cf2,0x19816c41),
|
||||
PCMCIA_MFC_DEVICE_PROD_ID12(1,"Elan","Serial Port: SL385",0x3beb8cf2,0x64112029),
|
||||
PCMCIA_MFC_DEVICE_PROD_ID12(1,"Elan","Serial Port: SL432",0x3beb8cf2,0x1cce7ac4),
|
||||
PCMCIA_MFC_DEVICE_PROD_ID12(2,"Elan","Serial Port: SL432",0x3beb8cf2,0x1cce7ac4),
|
||||
PCMCIA_MFC_DEVICE_PROD_ID12(3,"Elan","Serial Port: SL432",0x3beb8cf2,0x1cce7ac4),
|
||||
/* too generic */
|
||||
/* PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0160, 0x0002), */
|
||||
/* PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0160, 0x0002), */
|
||||
|
@ -69,25 +69,21 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
||||
|
||||
static void ixj_get_serial(struct pcmcia_device * link, IXJ * j)
|
||||
{
|
||||
tuple_t tuple;
|
||||
u_short buf[128];
|
||||
char *str;
|
||||
int last_ret, last_fn, i, place;
|
||||
int i, place;
|
||||
DEBUG(0, "ixj_get_serial(0x%p)\n", link);
|
||||
tuple.TupleData = (cisdata_t *) buf;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.TupleDataMax = 80;
|
||||
tuple.Attributes = 0;
|
||||
tuple.DesiredTuple = CISTPL_VERS_1;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
str = (char *) buf;
|
||||
printk("PCMCIA Version %d.%d\n", str[0], str[1]);
|
||||
str += 2;
|
||||
|
||||
str = link->prod_id[0];
|
||||
if (!str)
|
||||
goto cs_failed;
|
||||
printk("%s", str);
|
||||
str = str + strlen(str) + 1;
|
||||
str = link->prod_id[1];
|
||||
if (!str)
|
||||
goto cs_failed;
|
||||
printk(" %s", str);
|
||||
str = str + strlen(str) + 1;
|
||||
str = link->prod_id[2];
|
||||
if (!str)
|
||||
goto cs_failed;
|
||||
place = 1;
|
||||
for (i = strlen(str) - 1; i >= 0; i--) {
|
||||
switch (str[i]) {
|
||||
@ -122,7 +118,9 @@ static void ixj_get_serial(struct pcmcia_device * link, IXJ * j)
|
||||
}
|
||||
place = place * 0x10;
|
||||
}
|
||||
str = str + strlen(str) + 1;
|
||||
str = link->prod_id[3];
|
||||
if (!str)
|
||||
goto cs_failed;
|
||||
printk(" version %s\n", str);
|
||||
cs_failed:
|
||||
return;
|
||||
@ -146,13 +144,6 @@ static int ixj_config(struct pcmcia_device * link)
|
||||
tuple.TupleData = (cisdata_t *) buf;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.TupleDataMax = 255;
|
||||
tuple.Attributes = 0;
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
|
||||
tuple.Attributes = 0;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
|
@ -169,21 +169,14 @@ static int sl811_cs_config(struct pcmcia_device *link)
|
||||
|
||||
DBG(0, "sl811_cs_config(0x%p)\n", link);
|
||||
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
/* Look up the current Vcc */
|
||||
CS_CHECK(GetConfigurationInfo,
|
||||
pcmcia_get_configuration_info(link, &conf));
|
||||
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
while (1) {
|
||||
|
@ -262,9 +262,10 @@ struct pcmcia_socket {
|
||||
u8 present:1, /* PCMCIA card is present in socket */
|
||||
busy:1, /* "master" ioctl is used */
|
||||
dead:1, /* pcmcia module is being unloaded */
|
||||
device_add_pending:1, /* a pseudo-multifunction-device
|
||||
device_add_pending:1, /* a multifunction-device
|
||||
* add event is pending */
|
||||
reserved:4;
|
||||
mfc_pfc:1, /* the pending event adds a mfc (1) or pfc (0) */
|
||||
reserved:3;
|
||||
} pcmcia_state;
|
||||
|
||||
struct work_struct device_add; /* for adding further pseudo-multifunction
|
||||
|
@ -219,35 +219,15 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
||||
static int pdacf_config(struct pcmcia_device *link)
|
||||
{
|
||||
struct snd_pdacf *pdacf = link->priv;
|
||||
tuple_t tuple;
|
||||
cisparse_t *parse = NULL;
|
||||
u_short buf[32];
|
||||
int last_fn, last_ret;
|
||||
|
||||
snd_printdd(KERN_DEBUG "pdacf_config called\n");
|
||||
parse = kmalloc(sizeof(*parse), GFP_KERNEL);
|
||||
if (! parse) {
|
||||
snd_printk(KERN_ERR "pdacf_config: cannot allocate\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
|
||||
link->conf.ConfigBase = parse->config.base;
|
||||
link->conf.ConfigIndex = 0x5;
|
||||
|
||||
CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
|
||||
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
|
||||
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
|
||||
|
||||
kfree(parse);
|
||||
|
||||
if (snd_pdacf_assign_resources(pdacf, link->io.BasePort1, link->irq.AssignedIRQ) < 0)
|
||||
goto failed;
|
||||
|
||||
@ -255,7 +235,6 @@ static int pdacf_config(struct pcmcia_device *link)
|
||||
return 0;
|
||||
|
||||
cs_failed:
|
||||
kfree(parse);
|
||||
cs_error(link, last_fn, last_ret);
|
||||
failed:
|
||||
pcmcia_disable_device(link);
|
||||
@ -299,7 +278,8 @@ static int pdacf_resume(struct pcmcia_device *link)
|
||||
* Module entry points
|
||||
*/
|
||||
static struct pcmcia_device_id snd_pdacf_ids[] = {
|
||||
PCMCIA_DEVICE_MANF_CARD(0x015d, 0x4c45),
|
||||
/* this is too general PCMCIA_DEVICE_MANF_CARD(0x015d, 0x4c45), */
|
||||
PCMCIA_DEVICE_PROD_ID12("Core Sound","PDAudio-CF",0x396d19d2,0x71717b49),
|
||||
PCMCIA_DEVICE_NULL
|
||||
};
|
||||
MODULE_DEVICE_TABLE(pcmcia, snd_pdacf_ids);
|
||||
|
@ -217,34 +217,12 @@ static int vxpocket_config(struct pcmcia_device *link)
|
||||
{
|
||||
struct vx_core *chip = link->priv;
|
||||
struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip;
|
||||
tuple_t tuple;
|
||||
cisparse_t *parse;
|
||||
u_short buf[32];
|
||||
int last_fn, last_ret;
|
||||
|
||||
snd_printdd(KERN_DEBUG "vxpocket_config called\n");
|
||||
parse = kmalloc(sizeof(*parse), GFP_KERNEL);
|
||||
if (! parse) {
|
||||
snd_printk(KERN_ERR "vx: cannot allocate\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
tuple.Attributes = 0;
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
|
||||
link->conf.ConfigBase = parse->config.base;
|
||||
link->conf.Present = parse->config.rmask[0];
|
||||
|
||||
/* redefine hardware record according to the VERSION1 string */
|
||||
tuple.DesiredTuple = CISTPL_VERS_1;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
|
||||
if (! strcmp(parse->version_1.str + parse->version_1.ofs[1], "VX-POCKET")) {
|
||||
if (!strcmp(link->prod_id[1], "VX-POCKET")) {
|
||||
snd_printdd("VX-pocket is detected\n");
|
||||
} else {
|
||||
snd_printdd("VX-pocket 440 is detected\n");
|
||||
@ -265,14 +243,12 @@ static int vxpocket_config(struct pcmcia_device *link)
|
||||
goto failed;
|
||||
|
||||
link->dev_node = &vxp->node;
|
||||
kfree(parse);
|
||||
return 0;
|
||||
|
||||
cs_failed:
|
||||
cs_error(link, last_fn, last_ret);
|
||||
failed:
|
||||
pcmcia_disable_device(link);
|
||||
kfree(parse);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user