pcmcia: pcmcia_config_loop() improvement by passing vcc
By passing the current Vcc setting to the pcmcia_config_loop callback function, we can remove pcmcia_get_configuration_info() calls from many drivers. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
parent
8e2fc39dde
commit
ad913c1192
@ -150,7 +150,6 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
|||||||
|
|
||||||
|
|
||||||
struct pcmcia_config_check {
|
struct pcmcia_config_check {
|
||||||
config_info_t conf;
|
|
||||||
unsigned long ctl_base;
|
unsigned long ctl_base;
|
||||||
int skip_vcc;
|
int skip_vcc;
|
||||||
int is_kme;
|
int is_kme;
|
||||||
@ -159,6 +158,7 @@ struct pcmcia_config_check {
|
|||||||
static int pcmcia_check_one_config(struct pcmcia_device *pdev,
|
static int pcmcia_check_one_config(struct pcmcia_device *pdev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
struct pcmcia_config_check *stk = priv_data;
|
struct pcmcia_config_check *stk = priv_data;
|
||||||
@ -166,12 +166,10 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev,
|
|||||||
/* Check for matching Vcc, unless we're desperate */
|
/* Check for matching Vcc, unless we're desperate */
|
||||||
if (!stk->skip_vcc) {
|
if (!stk->skip_vcc) {
|
||||||
if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
||||||
if (stk->conf.Vcc !=
|
if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000)
|
||||||
cfg->vcc.param[CISTPL_POWER_VNOM] / 10000)
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
} else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
} else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
||||||
if (stk->conf.Vcc !=
|
if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000)
|
||||||
dflt->vcc.param[CISTPL_POWER_VNOM] / 10000)
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -257,10 +255,8 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
|
|||||||
if (!stk)
|
if (!stk)
|
||||||
goto out1;
|
goto out1;
|
||||||
stk->is_kme = is_kme;
|
stk->is_kme = is_kme;
|
||||||
|
|
||||||
/* Not sure if this is right... look up the current Vcc */
|
|
||||||
CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(pdev, &stk->conf));
|
|
||||||
stk->skip_vcc = io_base = ctl_base = 0;
|
stk->skip_vcc = io_base = ctl_base = 0;
|
||||||
|
|
||||||
if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) {
|
if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) {
|
||||||
stk->skip_vcc = 1;
|
stk->skip_vcc = 1;
|
||||||
if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk))
|
if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk))
|
||||||
|
@ -681,6 +681,7 @@ static void bt3c_detach(struct pcmcia_device *link)
|
|||||||
static int bt3c_check_config(struct pcmcia_device *p_dev,
|
static int bt3c_check_config(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cf,
|
cistpl_cftable_entry_t *cf,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
unsigned long try = (unsigned long) priv_data;
|
unsigned long try = (unsigned long) priv_data;
|
||||||
@ -701,6 +702,7 @@ static int bt3c_check_config(struct pcmcia_device *p_dev,
|
|||||||
static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev,
|
static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cf,
|
cistpl_cftable_entry_t *cf,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
|
static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
|
||||||
|
@ -610,16 +610,17 @@ static void btuart_detach(struct pcmcia_device *link)
|
|||||||
static int btuart_check_config(struct pcmcia_device *p_dev,
|
static int btuart_check_config(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cf,
|
cistpl_cftable_entry_t *cf,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
unsigned long try = (unsigned long) priv_data;
|
int *try = priv_data;
|
||||||
|
|
||||||
if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
|
if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
|
||||||
p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
|
p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
|
||||||
if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) &&
|
if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) &&
|
||||||
(cf->io.win[0].base != 0)) {
|
(cf->io.win[0].base != 0)) {
|
||||||
p_dev->io.BasePort1 = cf->io.win[0].base;
|
p_dev->io.BasePort1 = cf->io.win[0].base;
|
||||||
p_dev->io.IOAddrLines = (try == 0) ? 16 :
|
p_dev->io.IOAddrLines = (*try == 0) ? 16 :
|
||||||
cf->io.flags & CISTPL_IO_LINES_MASK;
|
cf->io.flags & CISTPL_IO_LINES_MASK;
|
||||||
if (!pcmcia_request_io(p_dev, &p_dev->io))
|
if (!pcmcia_request_io(p_dev, &p_dev->io))
|
||||||
return 0;
|
return 0;
|
||||||
@ -630,6 +631,7 @@ static int btuart_check_config(struct pcmcia_device *p_dev,
|
|||||||
static int btuart_check_config_notpicky(struct pcmcia_device *p_dev,
|
static int btuart_check_config_notpicky(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cf,
|
cistpl_cftable_entry_t *cf,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
|
static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
|
||||||
@ -650,13 +652,12 @@ static int btuart_config(struct pcmcia_device *link)
|
|||||||
{
|
{
|
||||||
btuart_info_t *info = link->priv;
|
btuart_info_t *info = link->priv;
|
||||||
int i;
|
int i;
|
||||||
unsigned long try;
|
int try;
|
||||||
|
|
||||||
/* First pass: look for a config entry that looks normal.
|
/* First pass: look for a config entry that looks normal.
|
||||||
Two tries: without IO aliases, then with aliases */
|
Two tries: without IO aliases, then with aliases */
|
||||||
for (try = 0; try < 2; try++)
|
for (try = 0; try < 2; try++)
|
||||||
if (!pcmcia_loop_config(link, btuart_check_config,
|
if (!pcmcia_loop_config(link, btuart_check_config, &try))
|
||||||
(void *) try))
|
|
||||||
goto found_port;
|
goto found_port;
|
||||||
|
|
||||||
/* Second pass: try to find an entry that isn't picky about
|
/* Second pass: try to find an entry that isn't picky about
|
||||||
|
@ -593,6 +593,7 @@ static void dtl1_detach(struct pcmcia_device *link)
|
|||||||
static int dtl1_confcheck(struct pcmcia_device *p_dev,
|
static int dtl1_confcheck(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cf,
|
cistpl_cftable_entry_t *cf,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) {
|
if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) {
|
||||||
|
@ -1762,6 +1762,7 @@ static void cmm_cm4000_release(struct pcmcia_device * link)
|
|||||||
static int cm4000_config_check(struct pcmcia_device *p_dev,
|
static int cm4000_config_check(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
if (!cfg->io.nwin)
|
if (!cfg->io.nwin)
|
||||||
|
@ -529,6 +529,7 @@ static void cm4040_reader_release(struct pcmcia_device *link)
|
|||||||
static int cm4040_config_check(struct pcmcia_device *p_dev,
|
static int cm4040_config_check(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -221,7 +221,6 @@ static struct ide_host *idecs_register(unsigned long io, unsigned long ctl,
|
|||||||
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
||||||
|
|
||||||
struct pcmcia_config_check {
|
struct pcmcia_config_check {
|
||||||
config_info_t conf;
|
|
||||||
unsigned long ctl_base;
|
unsigned long ctl_base;
|
||||||
int skip_vcc;
|
int skip_vcc;
|
||||||
int is_kme;
|
int is_kme;
|
||||||
@ -230,6 +229,7 @@ struct pcmcia_config_check {
|
|||||||
static int pcmcia_check_one_config(struct pcmcia_device *pdev,
|
static int pcmcia_check_one_config(struct pcmcia_device *pdev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
struct pcmcia_config_check *stk = priv_data;
|
struct pcmcia_config_check *stk = priv_data;
|
||||||
@ -237,12 +237,10 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev,
|
|||||||
/* Check for matching Vcc, unless we're desperate */
|
/* Check for matching Vcc, unless we're desperate */
|
||||||
if (!stk->skip_vcc) {
|
if (!stk->skip_vcc) {
|
||||||
if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
||||||
if (stk->conf.Vcc !=
|
if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000)
|
||||||
cfg->vcc.param[CISTPL_POWER_VNOM] / 10000)
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
} else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
} else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
||||||
if (stk->conf.Vcc !=
|
if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000)
|
||||||
dflt->vcc.param[CISTPL_POWER_VNOM] / 10000)
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -298,10 +296,8 @@ static int ide_config(struct pcmcia_device *link)
|
|||||||
if (!stk)
|
if (!stk)
|
||||||
goto err_mem;
|
goto err_mem;
|
||||||
stk->is_kme = is_kme;
|
stk->is_kme = is_kme;
|
||||||
|
|
||||||
/* Not sure if this is right... look up the current Vcc */
|
|
||||||
CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf));
|
|
||||||
stk->skip_vcc = io_base = ctl_base = 0;
|
stk->skip_vcc = io_base = ctl_base = 0;
|
||||||
|
|
||||||
if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) {
|
if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) {
|
||||||
stk->skip_vcc = 1;
|
stk->skip_vcc = 1;
|
||||||
if (pcmcia_loop_config(link, pcmcia_check_one_config, stk))
|
if (pcmcia_loop_config(link, pcmcia_check_one_config, stk))
|
||||||
|
@ -157,6 +157,7 @@ static void avmcs_detach(struct pcmcia_device *link)
|
|||||||
static int avmcs_configcheck(struct pcmcia_device *p_dev,
|
static int avmcs_configcheck(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cf,
|
cistpl_cftable_entry_t *cf,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
if (cf->io.nwin <= 0)
|
if (cf->io.nwin <= 0)
|
||||||
|
@ -177,6 +177,7 @@ static void avma1cs_detach(struct pcmcia_device *link)
|
|||||||
static int avma1cs_configcheck(struct pcmcia_device *p_dev,
|
static int avma1cs_configcheck(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cf,
|
cistpl_cftable_entry_t *cf,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
if (cf->io.nwin <= 0)
|
if (cf->io.nwin <= 0)
|
||||||
|
@ -207,6 +207,7 @@ static void elsa_cs_detach(struct pcmcia_device *link)
|
|||||||
static int elsa_cs_configcheck(struct pcmcia_device *p_dev,
|
static int elsa_cs_configcheck(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cf,
|
cistpl_cftable_entry_t *cf,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
@ -217,17 +217,13 @@ static void sedlbauer_detach(struct pcmcia_device *link)
|
|||||||
#define CS_CHECK(fn, ret) \
|
#define CS_CHECK(fn, ret) \
|
||||||
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
||||||
|
|
||||||
struct sedlbauer_config_data {
|
|
||||||
config_info_t conf;
|
|
||||||
win_req_t req;
|
|
||||||
};
|
|
||||||
|
|
||||||
static int sedlbauer_config_check(struct pcmcia_device *p_dev,
|
static int sedlbauer_config_check(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
struct sedlbauer_config_data *cfg_mem = priv_data;
|
win_req_t *req = priv_data;
|
||||||
|
|
||||||
if (cfg->index == 0)
|
if (cfg->index == 0)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
@ -241,12 +237,10 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
|
|||||||
/* Use power settings for Vcc and Vpp if present */
|
/* Use power settings for Vcc and Vpp if present */
|
||||||
/* Note that the CIS values need to be rescaled */
|
/* Note that the CIS values need to be rescaled */
|
||||||
if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) {
|
if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) {
|
||||||
if (cfg_mem->conf.Vcc !=
|
if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000)
|
||||||
cfg->vcc.param[CISTPL_POWER_VNOM]/10000)
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
} else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) {
|
} else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) {
|
||||||
if (cfg_mem->conf.Vcc !=
|
if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM]/10000)
|
||||||
dflt->vcc.param[CISTPL_POWER_VNOM]/10000)
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,12 +288,12 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
|
|||||||
if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) {
|
if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) {
|
||||||
cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem;
|
cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem;
|
||||||
memreq_t map;
|
memreq_t map;
|
||||||
cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM;
|
req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM;
|
||||||
cfg_mem->req.Attributes |= WIN_ENABLE;
|
req->Attributes |= WIN_ENABLE;
|
||||||
cfg_mem->req.Base = mem->win[0].host_addr;
|
req->Base = mem->win[0].host_addr;
|
||||||
cfg_mem->req.Size = mem->win[0].len;
|
req->Size = mem->win[0].len;
|
||||||
cfg_mem->req.AccessSpeed = 0;
|
req->AccessSpeed = 0;
|
||||||
if (pcmcia_request_window(&p_dev, &cfg_mem->req, &p_dev->win) != 0)
|
if (pcmcia_request_window(&p_dev, req, &p_dev->win) != 0)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
map.Page = 0;
|
map.Page = 0;
|
||||||
map.CardOffset = mem->win[0].card_addr;
|
map.CardOffset = mem->win[0].card_addr;
|
||||||
@ -314,20 +308,16 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
|
|||||||
static int sedlbauer_config(struct pcmcia_device *link)
|
static int sedlbauer_config(struct pcmcia_device *link)
|
||||||
{
|
{
|
||||||
local_info_t *dev = link->priv;
|
local_info_t *dev = link->priv;
|
||||||
struct sedlbauer_config_data *cfg_mem;
|
win_req_t *req;
|
||||||
int last_fn, last_ret;
|
int last_fn, last_ret;
|
||||||
IsdnCard_t icard;
|
IsdnCard_t icard;
|
||||||
|
|
||||||
DEBUG(0, "sedlbauer_config(0x%p)\n", link);
|
DEBUG(0, "sedlbauer_config(0x%p)\n", link);
|
||||||
|
|
||||||
cfg_mem = kzalloc(sizeof(struct sedlbauer_config_data), GFP_KERNEL);
|
req = kzalloc(sizeof(win_req_t), GFP_KERNEL);
|
||||||
if (!cfg_mem)
|
if (!req)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
/* Look up the current Vcc */
|
|
||||||
CS_CHECK(GetConfigurationInfo,
|
|
||||||
pcmcia_get_configuration_info(link, &cfg_mem->conf));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
In this loop, we scan the CIS for configuration table entries,
|
In this loop, we scan the CIS for configuration table entries,
|
||||||
each of which describes a valid card configuration, including
|
each of which describes a valid card configuration, including
|
||||||
@ -340,7 +330,7 @@ static int sedlbauer_config(struct pcmcia_device *link)
|
|||||||
these things without consulting the CIS, and most client drivers
|
these things without consulting the CIS, and most client drivers
|
||||||
will only use the CIS to fill in implementation-defined details.
|
will only use the CIS to fill in implementation-defined details.
|
||||||
*/
|
*/
|
||||||
last_ret = pcmcia_loop_config(link, sedlbauer_config_check, cfg_mem);
|
last_ret = pcmcia_loop_config(link, sedlbauer_config_check, req);
|
||||||
if (last_ret)
|
if (last_ret)
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
@ -381,8 +371,8 @@ static int sedlbauer_config(struct pcmcia_device *link)
|
|||||||
printk(" & 0x%04x-0x%04x", link->io.BasePort2,
|
printk(" & 0x%04x-0x%04x", link->io.BasePort2,
|
||||||
link->io.BasePort2+link->io.NumPorts2-1);
|
link->io.BasePort2+link->io.NumPorts2-1);
|
||||||
if (link->win)
|
if (link->win)
|
||||||
printk(", mem 0x%06lx-0x%06lx", cfg_mem->req.Base,
|
printk(", mem 0x%06lx-0x%06lx", req->Base,
|
||||||
cfg_mem->req.Base+cfg_mem->req.Size-1);
|
req->Base+req->Size-1);
|
||||||
printk("\n");
|
printk("\n");
|
||||||
|
|
||||||
icard.para[0] = link->irq.AssignedIRQ;
|
icard.para[0] = link->irq.AssignedIRQ;
|
||||||
|
@ -197,6 +197,7 @@ static void teles_detach(struct pcmcia_device *link)
|
|||||||
static int teles_cs_configcheck(struct pcmcia_device *p_dev,
|
static int teles_cs_configcheck(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cf,
|
cistpl_cftable_entry_t *cf,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
@ -287,6 +287,7 @@ static int try_io_port(struct pcmcia_device *link)
|
|||||||
static int axnet_configcheck(struct pcmcia_device *p_dev,
|
static int axnet_configcheck(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -515,6 +515,7 @@ static int try_io_port(struct pcmcia_device *link)
|
|||||||
static int pcnet_confcheck(struct pcmcia_device *p_dev,
|
static int pcnet_confcheck(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
int *has_shmem = priv_data;
|
int *has_shmem = priv_data;
|
||||||
|
@ -462,6 +462,7 @@ static int mhz_3288_power(struct pcmcia_device *link)
|
|||||||
static int mhz_mfc_config_check(struct pcmcia_device *p_dev,
|
static int mhz_mfc_config_check(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cf,
|
cistpl_cftable_entry_t *cf,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
int k;
|
int k;
|
||||||
@ -653,6 +654,7 @@ static int mot_setup(struct pcmcia_device *link)
|
|||||||
static int smc_configcheck(struct pcmcia_device *p_dev,
|
static int smc_configcheck(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cf,
|
cistpl_cftable_entry_t *cf,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
p_dev->io.BasePort1 = cf->io.win[0].base;
|
p_dev->io.BasePort1 = cf->io.win[0].base;
|
||||||
|
@ -719,6 +719,7 @@ static int
|
|||||||
xirc2ps_config_modem(struct pcmcia_device *p_dev,
|
xirc2ps_config_modem(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cf,
|
cistpl_cftable_entry_t *cf,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
unsigned int ioaddr;
|
unsigned int ioaddr;
|
||||||
@ -738,6 +739,7 @@ static int
|
|||||||
xirc2ps_config_check(struct pcmcia_device *p_dev,
|
xirc2ps_config_check(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cf,
|
cistpl_cftable_entry_t *cf,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
int *pass = priv_data;
|
int *pass = priv_data;
|
||||||
|
@ -209,6 +209,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
|||||||
static int airo_cs_config_check(struct pcmcia_device *p_dev,
|
static int airo_cs_config_check(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
win_req_t *req = priv_data;
|
win_req_t *req = priv_data;
|
||||||
|
@ -227,6 +227,7 @@ static int card_present(void *arg)
|
|||||||
static int atmel_config_check(struct pcmcia_device *p_dev,
|
static int atmel_config_check(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
if (cfg->index == 0)
|
if (cfg->index == 0)
|
||||||
|
@ -536,17 +536,12 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
|||||||
/* run after a CARD_INSERTION event is received to configure the PCMCIA
|
/* run after a CARD_INSERTION event is received to configure the PCMCIA
|
||||||
* socket and make the device available to the system */
|
* socket and make the device available to the system */
|
||||||
|
|
||||||
struct prism2_config_data {
|
|
||||||
config_info_t conf;
|
|
||||||
};
|
|
||||||
|
|
||||||
static int prism2_config_check(struct pcmcia_device *p_dev,
|
static int prism2_config_check(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
struct prism2_config_data *cfg_mem = priv_data;
|
|
||||||
|
|
||||||
if (cfg->index == 0)
|
if (cfg->index == 0)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
@ -562,14 +557,14 @@ static int prism2_config_check(struct pcmcia_device *p_dev,
|
|||||||
/* Use power settings for Vcc and Vpp if present */
|
/* Use power settings for Vcc and Vpp if present */
|
||||||
/* Note that the CIS values need to be rescaled */
|
/* Note that the CIS values need to be rescaled */
|
||||||
if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
||||||
if (cfg_mem->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] /
|
if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] /
|
||||||
10000 && !ignore_cis_vcc) {
|
10000 && !ignore_cis_vcc) {
|
||||||
PDEBUG(DEBUG_EXTRA, " Vcc mismatch - skipping"
|
PDEBUG(DEBUG_EXTRA, " Vcc mismatch - skipping"
|
||||||
" this entry\n");
|
" this entry\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
} else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
} else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
||||||
if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] /
|
if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] /
|
||||||
10000 && !ignore_cis_vcc) {
|
10000 && !ignore_cis_vcc) {
|
||||||
PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch "
|
PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch "
|
||||||
"- skipping this entry\n");
|
"- skipping this entry\n");
|
||||||
@ -627,7 +622,6 @@ static int prism2_config(struct pcmcia_device *link)
|
|||||||
{
|
{
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
struct hostap_interface *iface;
|
struct hostap_interface *iface;
|
||||||
struct prism2_config_data *cfg_mem;
|
|
||||||
local_info_t *local;
|
local_info_t *local;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
int last_fn, last_ret;
|
int last_fn, last_ret;
|
||||||
@ -635,21 +629,14 @@ static int prism2_config(struct pcmcia_device *link)
|
|||||||
|
|
||||||
PDEBUG(DEBUG_FLOW, "prism2_config()\n");
|
PDEBUG(DEBUG_FLOW, "prism2_config()\n");
|
||||||
|
|
||||||
cfg_mem = kzalloc(sizeof(struct prism2_config_data), GFP_KERNEL);
|
|
||||||
if (!cfg_mem)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL);
|
hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL);
|
||||||
if (hw_priv == NULL) {
|
if (hw_priv == NULL) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
CS_CHECK(GetConfigurationInfo,
|
|
||||||
pcmcia_get_configuration_info(link, &cfg_mem->conf));
|
|
||||||
|
|
||||||
/* Look for an appropriate configuration table entry in the CIS */
|
/* Look for an appropriate configuration table entry in the CIS */
|
||||||
last_ret = pcmcia_loop_config(link, prism2_config_check, cfg_mem);
|
last_ret = pcmcia_loop_config(link, prism2_config_check, NULL);
|
||||||
if (last_ret) {
|
if (last_ret) {
|
||||||
if (!ignore_cis_vcc)
|
if (!ignore_cis_vcc)
|
||||||
printk(KERN_ERR "GetNextTuple(): No matching "
|
printk(KERN_ERR "GetNextTuple(): No matching "
|
||||||
@ -724,7 +711,6 @@ static int prism2_config(struct pcmcia_device *link)
|
|||||||
if (ret == 0 && local->ddev)
|
if (ret == 0 && local->ddev)
|
||||||
strcpy(hw_priv->node.dev_name, local->ddev->name);
|
strcpy(hw_priv->node.dev_name, local->ddev->name);
|
||||||
}
|
}
|
||||||
kfree(cfg_mem);
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
cs_failed:
|
cs_failed:
|
||||||
@ -732,7 +718,6 @@ static int prism2_config(struct pcmcia_device *link)
|
|||||||
|
|
||||||
failed:
|
failed:
|
||||||
kfree(hw_priv);
|
kfree(hw_priv);
|
||||||
kfree(cfg_mem);
|
|
||||||
prism2_release((u_long)link);
|
prism2_release((u_long)link);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -164,31 +164,26 @@ static void orinoco_cs_detach(struct pcmcia_device *link)
|
|||||||
last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; \
|
last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
struct orinoco_cs_config_data {
|
|
||||||
config_info_t conf;
|
|
||||||
};
|
|
||||||
|
|
||||||
static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
|
static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
struct orinoco_cs_config_data *cfg_mem = priv_data;
|
|
||||||
|
|
||||||
if (cfg->index == 0)
|
if (cfg->index == 0)
|
||||||
goto next_entry;
|
goto next_entry;
|
||||||
|
|
||||||
/* Use power settings for Vcc and Vpp if present */
|
/* Use power settings for Vcc and Vpp if present */
|
||||||
/* Note that the CIS values need to be rescaled */
|
/* Note that the CIS values need to be rescaled */
|
||||||
if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
||||||
if (cfg_mem->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) {
|
if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) {
|
||||||
DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000);
|
DEBUG(2, "spectrum_cs_config: Vcc mismatch (vcc = %d, CIS = %d)\n", vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000);
|
||||||
if (!ignore_cis_vcc)
|
if (!ignore_cis_vcc)
|
||||||
goto next_entry;
|
goto next_entry;
|
||||||
}
|
}
|
||||||
} else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
} else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
||||||
if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) {
|
if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) {
|
||||||
DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, dflt->vcc.param[CISTPL_POWER_VNOM] / 10000);
|
DEBUG(2, "spectrum_cs_config: Vcc mismatch (vcc = %d, CIS = %d)\n", vcc, dflt->vcc.param[CISTPL_POWER_VNOM] / 10000);
|
||||||
if (!ignore_cis_vcc)
|
if (!ignore_cis_vcc)
|
||||||
goto next_entry;
|
goto next_entry;
|
||||||
}
|
}
|
||||||
@ -236,7 +231,6 @@ static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
|
|||||||
static int
|
static int
|
||||||
orinoco_cs_config(struct pcmcia_device *link)
|
orinoco_cs_config(struct pcmcia_device *link)
|
||||||
{
|
{
|
||||||
struct orinoco_cs_config_data *cfg_mem;
|
|
||||||
struct net_device *dev = link->priv;
|
struct net_device *dev = link->priv;
|
||||||
struct orinoco_private *priv = netdev_priv(dev);
|
struct orinoco_private *priv = netdev_priv(dev);
|
||||||
struct orinoco_pccard *card = priv->card;
|
struct orinoco_pccard *card = priv->card;
|
||||||
@ -244,14 +238,6 @@ orinoco_cs_config(struct pcmcia_device *link)
|
|||||||
int last_fn, last_ret;
|
int last_fn, last_ret;
|
||||||
void __iomem *mem;
|
void __iomem *mem;
|
||||||
|
|
||||||
cfg_mem = kzalloc(sizeof(struct orinoco_cs_config_data), GFP_KERNEL);
|
|
||||||
if (!cfg_mem)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
/* Look up the current Vcc */
|
|
||||||
CS_CHECK(GetConfigurationInfo,
|
|
||||||
pcmcia_get_configuration_info(link, &cfg_mem->conf));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In this loop, we scan the CIS for configuration table
|
* In this loop, we scan the CIS for configuration table
|
||||||
* entries, each of which describes a valid card
|
* entries, each of which describes a valid card
|
||||||
@ -266,7 +252,7 @@ orinoco_cs_config(struct pcmcia_device *link)
|
|||||||
* and most client drivers will only use the CIS to fill in
|
* and most client drivers will only use the CIS to fill in
|
||||||
* implementation-defined details.
|
* implementation-defined details.
|
||||||
*/
|
*/
|
||||||
last_ret = pcmcia_loop_config(link, orinoco_cs_config_check, cfg_mem);
|
last_ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL);
|
||||||
if (last_ret) {
|
if (last_ret) {
|
||||||
if (!ignore_cis_vcc)
|
if (!ignore_cis_vcc)
|
||||||
printk(KERN_ERR PFX "GetNextTuple(): No matching "
|
printk(KERN_ERR PFX "GetNextTuple(): No matching "
|
||||||
@ -324,7 +310,6 @@ orinoco_cs_config(struct pcmcia_device *link)
|
|||||||
"0x%04x-0x%04x\n", dev->name, dev->dev.parent->bus_id,
|
"0x%04x-0x%04x\n", dev->name, dev->dev.parent->bus_id,
|
||||||
link->irq.AssignedIRQ, link->io.BasePort1,
|
link->irq.AssignedIRQ, link->io.BasePort1,
|
||||||
link->io.BasePort1 + link->io.NumPorts1 - 1);
|
link->io.BasePort1 + link->io.NumPorts1 - 1);
|
||||||
kfree(cfg_mem);
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cs_failed:
|
cs_failed:
|
||||||
@ -332,7 +317,6 @@ orinoco_cs_config(struct pcmcia_device *link)
|
|||||||
|
|
||||||
failed:
|
failed:
|
||||||
orinoco_cs_release(link);
|
orinoco_cs_release(link);
|
||||||
kfree(cfg_mem);
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
} /* orinoco_cs_config */
|
} /* orinoco_cs_config */
|
||||||
|
|
||||||
|
@ -633,31 +633,26 @@ static void spectrum_cs_detach(struct pcmcia_device *link)
|
|||||||
* device available to the system.
|
* device available to the system.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct spectrum_cs_config_data {
|
|
||||||
config_info_t conf;
|
|
||||||
};
|
|
||||||
|
|
||||||
static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
|
static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
struct spectrum_cs_config_data *cfg_mem = priv_data;
|
|
||||||
|
|
||||||
if (cfg->index == 0)
|
if (cfg->index == 0)
|
||||||
goto next_entry;
|
goto next_entry;
|
||||||
|
|
||||||
/* Use power settings for Vcc and Vpp if present */
|
/* Use power settings for Vcc and Vpp if present */
|
||||||
/* Note that the CIS values need to be rescaled */
|
/* Note that the CIS values need to be rescaled */
|
||||||
if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
||||||
if (cfg_mem->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) {
|
if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) {
|
||||||
DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000);
|
DEBUG(2, "spectrum_cs_config: Vcc mismatch (vcc = %d, CIS = %d)\n", vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000);
|
||||||
if (!ignore_cis_vcc)
|
if (!ignore_cis_vcc)
|
||||||
goto next_entry;
|
goto next_entry;
|
||||||
}
|
}
|
||||||
} else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
} else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
||||||
if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) {
|
if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) {
|
||||||
DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, dflt->vcc.param[CISTPL_POWER_VNOM] / 10000);
|
DEBUG(2, "spectrum_cs_config: Vcc mismatch (vcc = %d, CIS = %d)\n", vcc, dflt->vcc.param[CISTPL_POWER_VNOM] / 10000);
|
||||||
if (!ignore_cis_vcc)
|
if (!ignore_cis_vcc)
|
||||||
goto next_entry;
|
goto next_entry;
|
||||||
}
|
}
|
||||||
@ -705,7 +700,6 @@ static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
|
|||||||
static int
|
static int
|
||||||
spectrum_cs_config(struct pcmcia_device *link)
|
spectrum_cs_config(struct pcmcia_device *link)
|
||||||
{
|
{
|
||||||
struct spectrum_cs_config_data *cfg_mem;
|
|
||||||
struct net_device *dev = link->priv;
|
struct net_device *dev = link->priv;
|
||||||
struct orinoco_private *priv = netdev_priv(dev);
|
struct orinoco_private *priv = netdev_priv(dev);
|
||||||
struct orinoco_pccard *card = priv->card;
|
struct orinoco_pccard *card = priv->card;
|
||||||
@ -713,14 +707,6 @@ spectrum_cs_config(struct pcmcia_device *link)
|
|||||||
int last_fn, last_ret;
|
int last_fn, last_ret;
|
||||||
void __iomem *mem;
|
void __iomem *mem;
|
||||||
|
|
||||||
cfg_mem = kzalloc(sizeof(struct spectrum_cs_config_data), GFP_KERNEL);
|
|
||||||
if (!cfg_mem)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
/* Look up the current Vcc */
|
|
||||||
CS_CHECK(GetConfigurationInfo,
|
|
||||||
pcmcia_get_configuration_info(link, &cfg_mem->conf));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In this loop, we scan the CIS for configuration table
|
* In this loop, we scan the CIS for configuration table
|
||||||
* entries, each of which describes a valid card
|
* entries, each of which describes a valid card
|
||||||
@ -735,7 +721,7 @@ spectrum_cs_config(struct pcmcia_device *link)
|
|||||||
* and most client drivers will only use the CIS to fill in
|
* and most client drivers will only use the CIS to fill in
|
||||||
* implementation-defined details.
|
* implementation-defined details.
|
||||||
*/
|
*/
|
||||||
last_ret = pcmcia_loop_config(link, spectrum_cs_config_check, cfg_mem);
|
last_ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL);
|
||||||
if (last_ret) {
|
if (last_ret) {
|
||||||
if (!ignore_cis_vcc)
|
if (!ignore_cis_vcc)
|
||||||
printk(KERN_ERR PFX "GetNextTuple(): No matching "
|
printk(KERN_ERR PFX "GetNextTuple(): No matching "
|
||||||
@ -799,7 +785,6 @@ spectrum_cs_config(struct pcmcia_device *link)
|
|||||||
link->irq.AssignedIRQ, link->io.BasePort1,
|
link->irq.AssignedIRQ, link->io.BasePort1,
|
||||||
link->io.BasePort1 + link->io.NumPorts1 - 1);
|
link->io.BasePort1 + link->io.NumPorts1 - 1);
|
||||||
|
|
||||||
kfree(cfg_mem);
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cs_failed:
|
cs_failed:
|
||||||
@ -807,7 +792,6 @@ spectrum_cs_config(struct pcmcia_device *link)
|
|||||||
|
|
||||||
failed:
|
failed:
|
||||||
spectrum_cs_release(link);
|
spectrum_cs_release(link);
|
||||||
kfree(cfg_mem);
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
} /* spectrum_cs_config */
|
} /* spectrum_cs_config */
|
||||||
|
|
||||||
|
@ -152,6 +152,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
|||||||
static int parport_config_check(struct pcmcia_device *p_dev,
|
static int parport_config_check(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
|
if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
|
||||||
@ -169,6 +170,7 @@ static int parport_config_check(struct pcmcia_device *p_dev,
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parport_config(struct pcmcia_device *link)
|
static int parport_config(struct pcmcia_device *link)
|
||||||
|
@ -935,6 +935,7 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev,
|
|||||||
int (*conf_check) (struct pcmcia_device *p_dev,
|
int (*conf_check) (struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data),
|
void *priv_data),
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
@ -942,11 +943,15 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev,
|
|||||||
|
|
||||||
tuple_t *tuple;
|
tuple_t *tuple;
|
||||||
int ret = -ENODEV;
|
int ret = -ENODEV;
|
||||||
|
unsigned int vcc;
|
||||||
|
|
||||||
cfg_mem = kzalloc(sizeof(struct pcmcia_cfg_mem), GFP_KERNEL);
|
cfg_mem = kzalloc(sizeof(struct pcmcia_cfg_mem), GFP_KERNEL);
|
||||||
if (cfg_mem == NULL)
|
if (cfg_mem == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
/* get the current Vcc setting */
|
||||||
|
vcc = p_dev->socket->socket.Vcc;
|
||||||
|
|
||||||
tuple = &cfg_mem->tuple;
|
tuple = &cfg_mem->tuple;
|
||||||
tuple->TupleData = cfg_mem->buf;
|
tuple->TupleData = cfg_mem->buf;
|
||||||
tuple->TupleDataMax = 255;
|
tuple->TupleDataMax = 255;
|
||||||
@ -969,7 +974,7 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev,
|
|||||||
if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
|
if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
|
||||||
cfg_mem->dflt = *cfg;
|
cfg_mem->dflt = *cfg;
|
||||||
|
|
||||||
ret = conf_check(p_dev, cfg, &cfg_mem->dflt, priv_data);
|
ret = conf_check(p_dev, cfg, &cfg_mem->dflt, vcc, priv_data);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -143,6 +143,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
|||||||
static int aha152x_config_check(struct pcmcia_device *p_dev,
|
static int aha152x_config_check(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
/* For New Media T&J, look for a SCSI window */
|
/* For New Media T&J, look for a SCSI window */
|
||||||
|
@ -126,6 +126,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
|||||||
static int fdomain_config_check(struct pcmcia_device *p_dev,
|
static int fdomain_config_check(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
p_dev->io.BasePort1 = cfg->io.win[0].base;
|
p_dev->io.BasePort1 = cfg->io.win[0].base;
|
||||||
|
@ -1611,12 +1611,12 @@ static void nsp_cs_detach(struct pcmcia_device *link)
|
|||||||
struct nsp_cs_configdata {
|
struct nsp_cs_configdata {
|
||||||
nsp_hw_data *data;
|
nsp_hw_data *data;
|
||||||
win_req_t req;
|
win_req_t req;
|
||||||
config_info_t conf;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int nsp_cs_config_check(struct pcmcia_device *p_dev,
|
static int nsp_cs_config_check(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
struct nsp_cs_configdata *cfg_mem = priv_data;
|
struct nsp_cs_configdata *cfg_mem = priv_data;
|
||||||
@ -1633,10 +1633,10 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev,
|
|||||||
/* Use power settings for Vcc and Vpp if present */
|
/* Use power settings for Vcc and Vpp if present */
|
||||||
/* Note that the CIS values need to be rescaled */
|
/* Note that the CIS values need to be rescaled */
|
||||||
if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) {
|
if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) {
|
||||||
if (cfg_mem->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000)
|
if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) {
|
else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) {
|
||||||
if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM]/10000)
|
if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM]/10000)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1719,8 +1719,6 @@ static int nsp_cs_config(struct pcmcia_device *link)
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
cfg_mem->data = data;
|
cfg_mem->data = data;
|
||||||
|
|
||||||
/* Look up the current Vcc */
|
|
||||||
CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &cfg_mem->conf));
|
|
||||||
ret = pcmcia_loop_config(link, nsp_cs_config_check, cfg_mem);
|
ret = pcmcia_loop_config(link, nsp_cs_config_check, cfg_mem);
|
||||||
goto cs_failed;
|
goto cs_failed;
|
||||||
|
|
||||||
|
@ -198,6 +198,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
|||||||
static int qlogic_config_check(struct pcmcia_device *p_dev,
|
static int qlogic_config_check(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
p_dev->io.BasePort1 = cfg->io.win[0].base;
|
p_dev->io.BasePort1 = cfg->io.win[0].base;
|
||||||
|
@ -703,6 +703,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
|||||||
static int SYM53C500_config_check(struct pcmcia_device *p_dev,
|
static int SYM53C500_config_check(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
p_dev->io.BasePort1 = cfg->io.win[0].base;
|
p_dev->io.BasePort1 = cfg->io.win[0].base;
|
||||||
|
@ -444,6 +444,7 @@ first_tuple(struct pcmcia_device *handle, tuple_t * tuple, cisparse_t * parse)
|
|||||||
static int simple_config_check(struct pcmcia_device *p_dev,
|
static int simple_config_check(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cf,
|
cistpl_cftable_entry_t *cf,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
static const int size_table[2] = { 8, 16 };
|
static const int size_table[2] = { 8, 16 };
|
||||||
@ -467,6 +468,7 @@ static int simple_config_check(struct pcmcia_device *p_dev,
|
|||||||
static int simple_config_check_notpicky(struct pcmcia_device *p_dev,
|
static int simple_config_check_notpicky(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cf,
|
cistpl_cftable_entry_t *cf,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
|
static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
|
||||||
@ -549,6 +551,7 @@ static int simple_config(struct pcmcia_device *link)
|
|||||||
static int multi_config_check(struct pcmcia_device *p_dev,
|
static int multi_config_check(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cf,
|
cistpl_cftable_entry_t *cf,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
int *base2 = priv_data;
|
int *base2 = priv_data;
|
||||||
@ -569,6 +572,7 @@ static int multi_config_check(struct pcmcia_device *p_dev,
|
|||||||
static int multi_config_check_notpicky(struct pcmcia_device *p_dev,
|
static int multi_config_check_notpicky(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cf,
|
cistpl_cftable_entry_t *cf,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
int *base2 = priv_data;
|
int *base2 = priv_data;
|
||||||
|
@ -127,6 +127,7 @@ static void ixj_get_serial(struct pcmcia_device * link, IXJ * j)
|
|||||||
static int ixj_config_check(struct pcmcia_device *p_dev,
|
static int ixj_config_check(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
|
if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
|
||||||
|
@ -155,29 +155,22 @@ static void sl811_cs_release(struct pcmcia_device * link)
|
|||||||
platform_device_unregister(&platform_dev);
|
platform_device_unregister(&platform_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sl811_css_cfg {
|
|
||||||
config_info_t conf;
|
|
||||||
};
|
|
||||||
|
|
||||||
static int sl811_cs_config_check(struct pcmcia_device *p_dev,
|
static int sl811_cs_config_check(struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cfg,
|
cistpl_cftable_entry_t *cfg,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data)
|
void *priv_data)
|
||||||
{
|
{
|
||||||
struct sl811_css_cfg *cfg_mem = priv_data;
|
|
||||||
|
|
||||||
if (cfg->index == 0)
|
if (cfg->index == 0)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
/* Use power settings for Vcc and Vpp if present */
|
/* Use power settings for Vcc and Vpp if present */
|
||||||
/* Note that the CIS values need to be rescaled */
|
/* Note that the CIS values need to be rescaled */
|
||||||
if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) {
|
if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) {
|
||||||
if (cfg->vcc.param[CISTPL_POWER_VNOM]/10000 !=
|
if (cfg->vcc.param[CISTPL_POWER_VNOM]/10000 != vcc)
|
||||||
cfg_mem->conf.Vcc)
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
} else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) {
|
} else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) {
|
||||||
if (dflt->vcc.param[CISTPL_POWER_VNOM]/10000
|
if (dflt->vcc.param[CISTPL_POWER_VNOM]/10000 != vcc)
|
||||||
!= cfg_mem->conf.Vcc)
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,29 +207,20 @@ static int sl811_cs_config(struct pcmcia_device *link)
|
|||||||
struct device *parent = &handle_to_dev(link);
|
struct device *parent = &handle_to_dev(link);
|
||||||
local_info_t *dev = link->priv;
|
local_info_t *dev = link->priv;
|
||||||
int last_fn, last_ret;
|
int last_fn, last_ret;
|
||||||
struct sl811_css_cfg *cfg_mem;
|
|
||||||
|
|
||||||
DBG(0, "sl811_cs_config(0x%p)\n", link);
|
DBG(0, "sl811_cs_config(0x%p)\n", link);
|
||||||
|
|
||||||
cfg_mem = kzalloc(sizeof(struct sl811_css_cfg), GFP_KERNEL);
|
if (pcmcia_loop_config(link, sl811_cs_config_check, NULL))
|
||||||
if (!cfg_mem)
|
goto failed;
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
/* Look up the current Vcc */
|
|
||||||
CS_CHECK(GetConfigurationInfo,
|
|
||||||
pcmcia_get_configuration_info(link, &cfg_mem->conf));
|
|
||||||
|
|
||||||
if (pcmcia_loop_config(link, sl811_cs_config_check, cfg_mem))
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
/* require an IRQ and two registers */
|
/* require an IRQ and two registers */
|
||||||
if (!link->io.NumPorts1 || link->io.NumPorts1 < 2)
|
if (!link->io.NumPorts1 || link->io.NumPorts1 < 2)
|
||||||
goto cs_failed;
|
goto failed;
|
||||||
if (link->conf.Attributes & CONF_ENABLE_IRQ)
|
if (link->conf.Attributes & CONF_ENABLE_IRQ)
|
||||||
CS_CHECK(RequestIRQ,
|
CS_CHECK(RequestIRQ,
|
||||||
pcmcia_request_irq(link, &link->irq));
|
pcmcia_request_irq(link, &link->irq));
|
||||||
else
|
else
|
||||||
goto cs_failed;
|
goto failed;
|
||||||
|
|
||||||
CS_CHECK(RequestConfiguration,
|
CS_CHECK(RequestConfiguration,
|
||||||
pcmcia_request_configuration(link, &link->conf));
|
pcmcia_request_configuration(link, &link->conf));
|
||||||
@ -257,13 +241,12 @@ static int sl811_cs_config(struct pcmcia_device *link)
|
|||||||
if (sl811_hc_init(parent, link->io.BasePort1, link->irq.AssignedIRQ)
|
if (sl811_hc_init(parent, link->io.BasePort1, link->irq.AssignedIRQ)
|
||||||
< 0) {
|
< 0) {
|
||||||
cs_failed:
|
cs_failed:
|
||||||
printk("sl811_cs_config failed\n");
|
|
||||||
cs_error(link, last_fn, last_ret);
|
cs_error(link, last_fn, last_ret);
|
||||||
|
failed:
|
||||||
|
printk(KERN_WARNING "sl811_cs_config failed\n");
|
||||||
sl811_cs_release(link);
|
sl811_cs_release(link);
|
||||||
kfree(cfg_mem);
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
kfree(cfg_mem);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -617,6 +617,7 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev,
|
|||||||
int (*conf_check) (struct pcmcia_device *p_dev,
|
int (*conf_check) (struct pcmcia_device *p_dev,
|
||||||
cistpl_cftable_entry_t *cf,
|
cistpl_cftable_entry_t *cf,
|
||||||
cistpl_cftable_entry_t *dflt,
|
cistpl_cftable_entry_t *dflt,
|
||||||
|
unsigned int vcc,
|
||||||
void *priv_data),
|
void *priv_data),
|
||||||
void *priv_data);
|
void *priv_data);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user