PCIe driver: fix load routines
This commit is contained in:
@@ -287,9 +287,15 @@ void jfjoch_clr_net_counters(struct jfjoch_drvdata *drvdata) {
|
||||
|
||||
int jfjoch_load_calibration(struct jfjoch_drvdata *drvdata, struct DataCollectionConfig *config) {
|
||||
struct device *const dev = &drvdata->pdev->dev;
|
||||
u32 i, tmp;
|
||||
u32 i, tmp, hls_ctrl_reg;
|
||||
u32 cell_count = config->nmodules * (3 + 3 * config->nstorage_cells);
|
||||
|
||||
hls_ctrl_reg = ioread32(drvdata->bar0 + ADDR_LOAD_CALIBRATION_CTRL);
|
||||
if ((hls_ctrl_reg & (1<<2)) == 0) {
|
||||
dev_err(dev, "Load calibration not ready for operation");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
if (cell_count > drvdata->nbuf) {
|
||||
dev_err(dev, "Not enough buffers to support this card\n");
|
||||
return -EINVAL;
|
||||
@@ -328,6 +334,12 @@ int jfjoch_load_calibration(struct jfjoch_drvdata *drvdata, struct DataCollectio
|
||||
if (i == 1000) {
|
||||
dev_err(dev, "Load calibration didn't finish in 10 seconds\n");
|
||||
return -ETIMEDOUT;
|
||||
} else {
|
||||
u32 ret = ioread32(drvdata->bar0 + ADDR_LOAD_CALIBRATION_RETURN);
|
||||
if (ret != 0) {
|
||||
dev_err(dev, "Load calibration error\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -336,7 +348,7 @@ int jfjoch_load_calibration(struct jfjoch_drvdata *drvdata, struct DataCollectio
|
||||
int jfjoch_load_integration_map(struct jfjoch_drvdata *drvdata, struct DataCollectionConfig *config) {
|
||||
struct device *const dev = &drvdata->pdev->dev;
|
||||
u32 i;
|
||||
u32 cell_count = config->nmodules;
|
||||
u32 cell_count = config->nmodules * 2;
|
||||
|
||||
if (cell_count > drvdata->nbuf) {
|
||||
dev_err(dev, "Not enough buffers to support this card\n");
|
||||
@@ -371,11 +383,12 @@ int jfjoch_load_integration_map(struct jfjoch_drvdata *drvdata, struct DataColle
|
||||
iowrite32(0, drvdata->bar0 + PCIE_OFFSET + (0<<12) + 0x04);
|
||||
|
||||
if (i == 1000) {
|
||||
dev_err(dev, "Load calibration didn't finish in 10 seconds\n");
|
||||
dev_err(dev, "Load integration map didn't finish in 10 seconds\n");
|
||||
return -ETIMEDOUT;
|
||||
} else {
|
||||
u32 ret = ioread32(drvdata->bar0 + ADDR_LOAD_CALIBRATION_RETURN);
|
||||
if (ret != 0) {
|
||||
dev_err(dev, "Load integration map error\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
@@ -422,8 +435,14 @@ int jfjoch_load_internal_generator_frame(struct jfjoch_drvdata *drvdata, struct
|
||||
iowrite32(0, drvdata->bar0 + PCIE_OFFSET + (0<<12) + 0x04);
|
||||
|
||||
if (i == 1000) {
|
||||
dev_err(dev, "Load calibration didn't finish in 10 seconds\n");
|
||||
dev_err(dev, "Load generator frame didn't finish in 10 seconds\n");
|
||||
return -ETIMEDOUT;
|
||||
} else {
|
||||
u32 ret = ioread32(drvdata->bar0 + ADDR_LOAD_CALIBRATION_RETURN);
|
||||
if (ret != 0) {
|
||||
dev_err(dev, "Load generator frame error\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user