svec: change to new fmc-bus allocation schema

parent 5febaac4
fmc-bus @ af52f48a
Subproject commit 143199350dc53bed3aeea2a5fe2a3270e6594caf
Subproject commit af52f48a588cec3db2a6adbd9f6b015b5b8c341e
......@@ -397,7 +397,7 @@ static int __devinit svec_probe(struct device *pdev, unsigned int ndev)
svec->vmebase = vmebase[ndev];
svec->vector = vector[ndev];
svec->level = SVEC_IRQ_LEVEL; /* Default value */
svec->fmcs_n = 2; /* FIXME: Two mezzanines */
svec->fmcs_n = SVEC_N_SLOTS; /* FIXME: Two mezzanines */
svec->dev = pdev;
/* Get firmware name */
......@@ -409,14 +409,6 @@ static int __devinit svec_probe(struct device *pdev, unsigned int ndev)
" using %s as default\n", svec->fw_name);
}
/* Alloc fmc structs memory */
svec->fmcs = kzalloc(svec->fmcs_n * sizeof(struct fmc_device),
GFP_KERNEL);
if (!svec->fmcs) {
error = -ENOMEM;
goto failed_mem;
}
/* Map CR/CSR space */
error = svec_map_window(svec, MAP_CR_CSR);
if (error)
......@@ -476,9 +468,6 @@ failed_unmap_crcsr:
svec_unmap_window(svec, MAP_CR_CSR);
failed:
kfree(svec->fmcs);
svec->fmcs = NULL;
failed_mem:
kfree(svec);
return error;
......
......@@ -180,9 +180,16 @@ static int check_golden(struct fmc_device *fmc)
int svec_fmc_prepare(struct svec_dev *svec, unsigned int fmc_slot)
{
struct fmc_device *fmc = svec->fmcs + fmc_slot;
struct fmc_device *fmc;
int ret = 0;
fmc = kzalloc(sizeof(*fmc), GFP_KERNEL);
if (!fmc) {
dev_err(svec->dev, "cannot allocate fmc slot %d\n",
fmc_slot);
return -ENOMEM;
}
/* FIXME: For now, only two mezzanines carrier */
if (fmc_slot < 0 || fmc_slot > 1)
return -EINVAL;
......@@ -202,6 +209,7 @@ int svec_fmc_prepare(struct svec_dev *svec, unsigned int fmc_slot)
fmc->device_id = (svec->slot << 6) | fmc_slot;
fmc->eeprom_addr = 0x50 + 2 * (1-fmc_slot);
fmc->memlen = 0x100000;
svec->fmcs[fmc_slot] = fmc;
#if 0
/* check golden integrity */
......
......@@ -18,6 +18,7 @@
#define SVEC_MAX_DEVICES 32
#define SVEC_DEFAULT_IDX { [0 ... (SVEC_MAX_DEVICES-1)] = -1 }
#define SVEC_IRQ_LEVEL 2
#define SVEC_N_SLOTS 2
#define SVEC_BASE_LOADER 0x70000
#define SVEC_VENDOR_ID 0x80030
......@@ -56,7 +57,8 @@ struct svec_dev {
struct list_head list;
unsigned long irqcount;
void *sub_priv;
struct fmc_device *fmcs; /* FMC devices */
struct fmc_device *fmcs[SVEC_N_SLOTS];
/* FMC devices */
int fmcs_n; /* Number of FMC devices */
int irq_count; /* for mezzanine use too */
struct completion compl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment