Commit 4e79a24c authored by Alessandro Rubini's avatar Alessandro Rubini

kernel: major message review

Messaging with cset->dev or fa->fmc->hwdev resulted in poor context:
"cset0" in the former case and the carrier name+id in the latter case.
This commit uses fa->fmc->dev, which has more context (more than hwdev
if the carrier is multi-mezzanine).

This also downgrades some dev_err to dev_info (all errors related with
invalid values written to attributes).
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 8d09350c
...@@ -44,7 +44,7 @@ int fa_probe(struct fmc_device *fmc) ...@@ -44,7 +44,7 @@ int fa_probe(struct fmc_device *fmc)
/* Validate the new FMC device */ /* Validate the new FMC device */
i = fmc->op->validate(fmc, &fa_dev_drv); i = fmc->op->validate(fmc, &fa_dev_drv);
if (i < 0) { if (i < 0) {
dev_info(fmc->hwdev, "not using \"%s\" according to " dev_info(&fmc->dev, "not using \"%s\" according to "
"modparam\n", KBUILD_MODNAME); "modparam\n", KBUILD_MODNAME);
return -ENODEV; return -ENODEV;
} }
...@@ -67,10 +67,10 @@ int fa_probe(struct fmc_device *fmc) ...@@ -67,10 +67,10 @@ int fa_probe(struct fmc_device *fmc)
/* init all subsystems */ /* init all subsystems */
for (i = 0, m = mods; i < ARRAY_SIZE(mods); i++, m++) { for (i = 0, m = mods; i < ARRAY_SIZE(mods); i++, m++) {
dev_dbg(fmc->hwdev, "Calling init for \"%s\"\n", m->name); dev_dbg(&fmc->dev, "Calling init for \"%s\"\n", m->name);
err = m->init(fa); err = m->init(fa);
if (err) { if (err) {
dev_err(fmc->hwdev, "error initializing %s\n", m->name); dev_err(&fmc->dev, "error initializing %s\n", m->name);
goto out; goto out;
} }
......
...@@ -129,6 +129,7 @@ int zfad_map_dma(struct zio_cset *cset, struct zfad_block *zfad_block, ...@@ -129,6 +129,7 @@ int zfad_map_dma(struct zio_cset *cset, struct zfad_block *zfad_block,
unsigned int n_blocks) unsigned int n_blocks)
{ {
struct fa_dev *fa = cset->zdev->priv_d; struct fa_dev *fa = cset->zdev->priv_d;
struct device *dev = &fa->fmc->dev;
struct scatterlist *sg; struct scatterlist *sg;
struct fa_dma_item *items; struct fa_dma_item *items;
uint32_t dev_mem_off = 0; uint32_t dev_mem_off = 0;
...@@ -138,17 +139,17 @@ int zfad_map_dma(struct zio_cset *cset, struct zfad_block *zfad_block, ...@@ -138,17 +139,17 @@ int zfad_map_dma(struct zio_cset *cset, struct zfad_block *zfad_block,
pages = zfat_calculate_nents(zfad_block, n_blocks); pages = zfat_calculate_nents(zfad_block, n_blocks);
if (!pages) { if (!pages) {
dev_err(&cset->head.dev, "No pages to transfer %i\n", dev_info(dev, "No pages to transfer %i\n",
n_blocks); n_blocks);
return -EINVAL; return -EINVAL;
} }
dev_dbg(&cset->head.dev, "using %d pages to transfer %i blocks\n", dev_dbg(dev, "using %d pages to transfer %i blocks\n",
pages, n_blocks); pages, n_blocks);
/* Create sglists for the transfers */ /* Create sglists for the transfers */
err = sg_alloc_table(&fa->sgt, pages, GFP_ATOMIC); err = sg_alloc_table(&fa->sgt, pages, GFP_ATOMIC);
if (err) { if (err) {
dev_err(&cset->head.dev, "cannot allocate sg table\n"); dev_err(dev, "cannot allocate sg table (%i pages)\n", pages);
goto out; goto out;
} }
...@@ -171,7 +172,7 @@ int zfad_map_dma(struct zio_cset *cset, struct zfad_block *zfad_block, ...@@ -171,7 +172,7 @@ int zfad_map_dma(struct zio_cset *cset, struct zfad_block *zfad_block,
sglen = dma_map_sg(fa->fmc->hwdev, fa->sgt.sgl, sglen = dma_map_sg(fa->fmc->hwdev, fa->sgt.sgl,
fa->sgt.nents, DMA_FROM_DEVICE); fa->sgt.nents, DMA_FROM_DEVICE);
if (!sglen) { if (!sglen) {
dev_err(fa->fmc->hwdev, "cannot map dma memory\n"); dev_err(dev, "cannot map dma memory\n");
goto out_map; goto out_map;
} }
...@@ -187,14 +188,13 @@ int zfad_map_dma(struct zio_cset *cset, struct zfad_block *zfad_block, ...@@ -187,14 +188,13 @@ int zfad_map_dma(struct zio_cset *cset, struct zfad_block *zfad_block,
i_blk++; /* index the next block */ i_blk++; /* index the next block */
if (unlikely(i_blk > n_blocks)) { if (unlikely(i_blk > n_blocks)) {
dev_err(&fa->zdev->head.dev, dev_err(dev, "DMA map out of block\n");
"DMA map out of block\n");
BUG(); BUG();
} }
} }
dev_dbg(&cset->head.dev, "configure DMA item %d" pr_debug("configure DMA item %d "
"(addr: 0x%llx len: %d)(dev off: 0x%x)\n", "(addr: 0x%llx len: %d)(dev off: 0x%x)\n",
i, (long long)sg_dma_address(sg), i, (long long)sg_dma_address(sg),
sg_dma_len(sg), dev_mem_off); sg_dma_len(sg), dev_mem_off);
......
...@@ -169,10 +169,11 @@ static inline int zfad_get_chx_index(unsigned long addr, ...@@ -169,10 +169,11 @@ static inline int zfad_get_chx_index(unsigned long addr,
*/ */
int zfad_fsm_command(struct fa_dev *fa, uint32_t command) int zfad_fsm_command(struct fa_dev *fa, uint32_t command)
{ {
struct device *dev = &fa->fmc->dev;
uint32_t val; uint32_t val;
if (command != ZFA_START && command != ZFA_STOP) { if (command != ZFA_START && command != ZFA_STOP) {
dev_err(fa->fmc->hwdev, "Invalid command\n"); dev_info(dev, "Invalid command %i\n", command);
return -EINVAL; return -EINVAL;
} }
...@@ -202,15 +203,15 @@ int zfad_fsm_command(struct fa_dev *fa, uint32_t command) ...@@ -202,15 +203,15 @@ int zfad_fsm_command(struct fa_dev *fa, uint32_t command)
/* Verify that SerDes PLL is lockes */ /* Verify that SerDes PLL is lockes */
zfa_hardware_read(fa, ZFA_STA_SERDES_PLL, &val); zfa_hardware_read(fa, ZFA_STA_SERDES_PLL, &val);
if (!val) { if (!val) {
dev_err(fa->fmc->hwdev, dev_info(dev, "Cannot start acquisition: "
"Cannot start acquisition: SerDes PLL not locked\n"); "SerDes PLL not locked\n");
return -EBUSY; return -EBUSY;
} }
/* Verify that SerDes is synched */ /* Verify that SerDes is synched */
zfa_hardware_read(fa, ZFA_STA_SERDES_SYNCED, &val); zfa_hardware_read(fa, ZFA_STA_SERDES_SYNCED, &val);
if (!val) { if (!val) {
dev_err(fa->fmc->hwdev, dev_info(dev, "Cannot start acquisition: "
"Cannot start acquisition: SerDes not synchronized\n"); "SerDes not synchronized\n");
return -EBUSY; return -EBUSY;
} }
...@@ -224,15 +225,15 @@ int zfad_fsm_command(struct fa_dev *fa, uint32_t command) ...@@ -224,15 +225,15 @@ int zfad_fsm_command(struct fa_dev *fa, uint32_t command)
* from zfat_arm_trigger() or zfad_input_cset() * from zfat_arm_trigger() or zfad_input_cset()
*/ */
if (!(fa->zdev->cset->ti->flags & ZIO_TI_ARMED)) { if (!(fa->zdev->cset->ti->flags & ZIO_TI_ARMED)) {
dev_err(fa->fmc->hwdev, dev_info(dev, "Cannot start acquisition: "
"Trigger not armed, cannot start acquisition\n"); "Trigger refuses to arm\n");
return -EPERM; return -EIO;
} }
dev_dbg(fa->fmc->hwdev, "FSM START Command, Enable interrupts\n"); dev_dbg(dev, "FSM START Command, Enable interrupts\n");
zfa_hardware_write(fa, ZFA_IRQ_MASK, ZFAT_ALL); zfa_hardware_write(fa, ZFA_IRQ_MASK, ZFAT_ALL);
} else { } else {
dev_dbg(fa->fmc->hwdev, "FSM STOP Command, Disable interrupts\n"); dev_dbg(dev, "FSM STOP Command, Disable interrupts\n");
zfa_hardware_write(fa, ZFA_IRQ_MASK, ZFAT_NONE); zfa_hardware_write(fa, ZFA_IRQ_MASK, ZFAT_NONE);
} }
...@@ -431,10 +432,8 @@ static int zfad_conf_set(struct device *dev, struct zio_attribute *zattr, ...@@ -431,10 +432,8 @@ static int zfad_conf_set(struct device *dev, struct zio_attribute *zattr,
zfad_reset_offset(fa); zfad_reset_offset(fa);
return 0; return 0;
case ZFAT_SR_DECI: case ZFAT_SR_DECI:
if (usr_val == 0) { if (usr_val == 0)
dev_err(dev, "max-sample-rate minimum value is 1\n"); usr_val++;
return -EINVAL;
}
break; break;
/* FIXME temporary until TLV control */ /* FIXME temporary until TLV control */
case ZFA_CH1_CTL_TERM: case ZFA_CH1_CTL_TERM:
...@@ -442,11 +441,8 @@ static int zfad_conf_set(struct device *dev, struct zio_attribute *zattr, ...@@ -442,11 +441,8 @@ static int zfad_conf_set(struct device *dev, struct zio_attribute *zattr,
case ZFA_CH3_CTL_TERM: case ZFA_CH3_CTL_TERM:
case ZFA_CH4_CTL_TERM: case ZFA_CH4_CTL_TERM:
case ZFA_CHx_CTL_TERM: case ZFA_CHx_CTL_TERM:
if (usr_val != 0 && usr_val != 1) { if (usr_val > 1)
dev_err(dev, "50 Ohm termination can be activated (1) " usr_val = 1;
"or deactivated (0)\n");
return -EINVAL;
}
break; break;
/* FIXME temporary until TLV control */ /* FIXME temporary until TLV control */
...@@ -595,13 +591,13 @@ static int zfad_input_cset(struct zio_cset *cset) ...@@ -595,13 +591,13 @@ static int zfad_input_cset(struct zio_cset *cset)
{ {
struct fa_dev *fa = cset->zdev->priv_d; struct fa_dev *fa = cset->zdev->priv_d;
dev_dbg(fa->fmc->hwdev, "Ready to acquire\n"); dev_dbg(&fa->fmc->dev, "Ready to acquire\n");
/* ZIO should configure only the interleaved channel */ /* ZIO should configure only the interleaved channel */
if (!cset->interleave) if (!cset->interleave)
return -EINVAL; return -EINVAL;
/* nsamples can't be 0 */ /* nsamples can't be 0 */
if (!cset->interleave->current_ctrl->nsamples) { if (!cset->interleave->current_ctrl->nsamples) {
dev_err(&cset->head.dev, "no post/pre-sample configured\n"); dev_info(&fa->fmc->dev, "pre + post = 0: can't acquire\n");
return -EINVAL; return -EINVAL;
} }
...@@ -654,7 +650,7 @@ static void zfat_get_irq_status(struct fa_dev *fa, ...@@ -654,7 +650,7 @@ static void zfat_get_irq_status(struct fa_dev *fa,
/* Get current interrupts status */ /* Get current interrupts status */
zfa_hardware_read(fa, ZFA_IRQ_SRC, irq_status); zfa_hardware_read(fa, ZFA_IRQ_SRC, irq_status);
zfa_hardware_read(fa, ZFA_IRQ_MULTI, irq_multi); zfa_hardware_read(fa, ZFA_IRQ_MULTI, irq_multi);
dev_dbg(fa->fmc->hwdev, "irq status = 0x%x multi = 0x%x\n", dev_dbg(&fa->fmc->dev, "irq status = 0x%x multi = 0x%x\n",
*irq_status, *irq_multi); *irq_status, *irq_multi);
/* Clear current interrupts status */ /* Clear current interrupts status */
...@@ -683,7 +679,7 @@ static void zfad_dma_start(struct zio_cset *cset) ...@@ -683,7 +679,7 @@ static void zfad_dma_start(struct zio_cset *cset)
/* Start DMA transefer */ /* Start DMA transefer */
zfa_hardware_write(fa, ZFA_DMA_CTL_START, 1); zfa_hardware_write(fa, ZFA_DMA_CTL_START, 1);
dev_dbg(fa->fmc->hwdev, "Start DMA transfer\n"); dev_dbg(&fa->fmc->dev, "Start DMA transfer\n");
} }
/** /**
...@@ -709,7 +705,7 @@ static void zfad_dma_done(struct zio_cset *cset) ...@@ -709,7 +705,7 @@ static void zfad_dma_done(struct zio_cset *cset)
* it can store blocks into the buffer * it can store blocks into the buffer
*/ */
zio_trigger_data_done(cset); zio_trigger_data_done(cset);
dev_dbg(fa->fmc->hwdev, "%i blocks transfered\n", fa->n_shots); dev_dbg(&fa->fmc->dev, "%i blocks transfered\n", fa->n_shots);
/* /*
* we can safely re-enable triggers. * we can safely re-enable triggers.
...@@ -725,13 +721,13 @@ static void zfad_dma_done(struct zio_cset *cset) ...@@ -725,13 +721,13 @@ static void zfad_dma_done(struct zio_cset *cset)
zfa_hardware_write(fa, ZFAT_CFG_SW_EN, zfa_hardware_write(fa, ZFAT_CFG_SW_EN,
ti->zattr_set.ext_zattr[5].value); ti->zattr_set.ext_zattr[5].value);
} else { } else {
dev_dbg(&cset->head.dev, "Software acquisition over"); dev_dbg(&fa->fmc->dev, "Software acquisition over");
zfa_hardware_write(fa, ZFAT_CFG_SW_EN, 1); zfa_hardware_write(fa, ZFAT_CFG_SW_EN, 1);
} }
/* Automatic start next acquisition */ /* Automatic start next acquisition */
if (enable_auto_start) { if (enable_auto_start) {
dev_dbg(fa->fmc->hwdev, "Automatic start\n"); dev_dbg(&fa->fmc->dev, "Automatic start\n");
zfad_fsm_command(fa, ZFA_START); zfad_fsm_command(fa, ZFA_START);
} }
} }
...@@ -752,7 +748,7 @@ static void zfad_dma_error(struct zio_cset *cset) ...@@ -752,7 +748,7 @@ static void zfad_dma_error(struct zio_cset *cset)
zfad_unmap_dma(cset, zfad_block); zfad_unmap_dma(cset, zfad_block);
zfa_hardware_read(fa, ZFA_DMA_STA, &val); zfa_hardware_read(fa, ZFA_DMA_STA, &val);
dev_err(fa->fmc->hwdev, dev_err(&fa->fmc->dev,
"DMA error (status 0x%x). All acquisition lost\n", val); "DMA error (status 0x%x). All acquisition lost\n", val);
zfad_fsm_command(fa, ZFA_STOP); zfad_fsm_command(fa, ZFA_STOP);
fa->n_dma_err++; fa->n_dma_err++;
...@@ -794,7 +790,7 @@ static void zfat_irq_trg_fire(struct zio_cset *cset) ...@@ -794,7 +790,7 @@ static void zfat_irq_trg_fire(struct zio_cset *cset)
struct zio_control *ctrl; struct zio_control *ctrl;
uint32_t dev_mem_off, trg_pos, pre_samp; uint32_t dev_mem_off, trg_pos, pre_samp;
dev_dbg(fa->fmc->hwdev, "Trigger fire %i/%i\n", dev_dbg(&fa->fmc->dev, "Trigger fire %i/%i\n",
fa->n_fires + 1, fa->n_shots); fa->n_fires + 1, fa->n_shots);
if (fa->n_fires >= fa->n_shots) { if (fa->n_fires >= fa->n_shots) {
WARN(1, "Invalid Fire, STOP acquisition"); WARN(1, "Invalid Fire, STOP acquisition");
...@@ -813,7 +809,7 @@ static void zfat_irq_trg_fire(struct zio_cset *cset) ...@@ -813,7 +809,7 @@ static void zfat_irq_trg_fire(struct zio_cset *cset)
zfa_hardware_read(fa, ZFAT_POS, &trg_pos); zfa_hardware_read(fa, ZFAT_POS, &trg_pos);
/* translate from sample count to memory offset */ /* translate from sample count to memory offset */
dev_mem_off = (trg_pos - pre_samp) * cset->ssize * nchan; dev_mem_off = (trg_pos - pre_samp) * cset->ssize * nchan;
dev_dbg(fa->fmc->hwdev, dev_dbg(&fa->fmc->dev,
"Trigger @ 0x%08x, pre %i, offset 0x%08x\n", "Trigger @ 0x%08x, pre %i, offset 0x%08x\n",
trg_pos, pre_samp, dev_mem_off); trg_pos, pre_samp, dev_mem_off);
...@@ -848,9 +844,9 @@ static void zfat_irq_acq_end(struct zio_cset *cset) ...@@ -848,9 +844,9 @@ static void zfat_irq_acq_end(struct zio_cset *cset)
uint32_t val = 0; uint32_t val = 0;
int try = 5; int try = 5;
dev_dbg(fa->fmc->hwdev, "Acquisition done\n"); dev_dbg(&fa->fmc->dev, "Acquisition done\n");
if (fa->n_fires != fa->n_shots) { if (fa->n_fires != fa->n_shots) {
dev_err(fa->fmc->hwdev, dev_err(&fa->fmc->dev,
"Expected %i trigger fires, but %i occurs\n", "Expected %i trigger fires, but %i occurs\n",
fa->n_shots, fa->n_fires); fa->n_shots, fa->n_fires);
} }
...@@ -866,7 +862,7 @@ static void zfat_irq_acq_end(struct zio_cset *cset) ...@@ -866,7 +862,7 @@ static void zfat_irq_acq_end(struct zio_cset *cset)
if (val != ZFA_STATE_IDLE) { if (val != ZFA_STATE_IDLE) {
/* we can't DMA if the state machine is not idle */ /* we can't DMA if the state machine is not idle */
dev_warn(fa->fmc->hwdev, dev_warn(&fa->fmc->dev,
"Can't start DMA on the last acquisition, " "Can't start DMA on the last acquisition, "
"State Machine is not IDLE (status:%d)\n", val); "State Machine is not IDLE (status:%d)\n", val);
zfad_fsm_command(fa, ZFA_STOP); zfad_fsm_command(fa, ZFA_STOP);
...@@ -912,7 +908,7 @@ static irqreturn_t zfad_irq(int irq, void *ptr) ...@@ -912,7 +908,7 @@ static irqreturn_t zfad_irq(int irq, void *ptr)
return IRQ_NONE; return IRQ_NONE;
irq_handler: irq_handler:
dev_dbg(fa->fmc->hwdev, "Handle ADC interrupts\n"); dev_dbg(&fa->fmc->dev, "Handle ADC interrupts\n");
if (unlikely((status & (ZFAT_DMA_DONE | ZFAT_DMA_ERR)) && if (unlikely((status & (ZFAT_DMA_DONE | ZFAT_DMA_ERR)) &&
(status & (ZFAT_TRG_FIRE | ZFAT_ACQ_END)))) { (status & (ZFAT_TRG_FIRE | ZFAT_ACQ_END)))) {
WARN(1, "Cannot handle trigger interrupt and DMA interrupt at " WARN(1, "Cannot handle trigger interrupt and DMA interrupt at "
...@@ -1004,7 +1000,7 @@ static int zfad_zio_probe(struct zio_device *zdev) ...@@ -1004,7 +1000,7 @@ static int zfad_zio_probe(struct zio_device *zdev)
err = fa->fmc->op->irq_request(fa->fmc, zfad_irq, "fmc-adc-100m14b", err = fa->fmc->op->irq_request(fa->fmc, zfad_irq, "fmc-adc-100m14b",
IRQF_SHARED); IRQF_SHARED);
if (err) if (err)
dev_err(fa->fmc->hwdev, "can't request irq %i (err %i)\n", dev_err(&fa->fmc->dev, "can't request irq %i (error %i)\n",
fa->fmc->irq, err); fa->fmc->irq, err);
/* Force stop FSM to prevent early trigger fire */ /* Force stop FSM to prevent early trigger fire */
...@@ -1155,15 +1151,15 @@ void fa_zio_unregister(void) ...@@ -1155,15 +1151,15 @@ void fa_zio_unregister(void)
int fa_zio_init(struct fa_dev *fa) int fa_zio_init(struct fa_dev *fa)
{ {
struct device *hwdev = fa->fmc->hwdev; struct device *hwdev = fa->fmc->hwdev;
struct device *msgdev = &fa->fmc->dev;
uint32_t val; uint32_t val;
int err; int err;
/* Check if hardware supports 64-bit DMA */ /* Check if hardware supports 64-bit DMA */
if(dma_set_mask(hwdev, DMA_BIT_MASK(64))) { if(dma_set_mask(hwdev, DMA_BIT_MASK(64))) {
dev_err(hwdev, "64-bit DMA addressing not available, try 32\n");
/* Check if hardware supports 32-bit DMA */ /* Check if hardware supports 32-bit DMA */
if(dma_set_mask(hwdev, DMA_BIT_MASK(32))) { if(dma_set_mask(hwdev, DMA_BIT_MASK(32))) {
dev_err(hwdev, "32-bit DMA addressing not available\n"); dev_err(msgdev, "32-bit DMA addressing not available\n");
return -EINVAL; return -EINVAL;
} }
} }
...@@ -1172,26 +1168,26 @@ int fa_zio_init(struct fa_dev *fa) ...@@ -1172,26 +1168,26 @@ int fa_zio_init(struct fa_dev *fa)
/* Verify that the FMC is plugged (0 is plugged) */ /* Verify that the FMC is plugged (0 is plugged) */
zfa_hardware_read(fa, ZFA_CAR_FMC_PRES, &val); zfa_hardware_read(fa, ZFA_CAR_FMC_PRES, &val);
if (val) { if (val) {
dev_err(hwdev, "No FCM ADC plugged\n"); dev_err(msgdev, "No FCM ADC plugged\n");
return -ENODEV; return -ENODEV;
} }
/* Verify that system PLL is locked (1 is calibrated) */ /* Verify that system PLL is locked (1 is calibrated) */
zfa_hardware_read(fa, ZFA_CAR_SYS_PLL, &val); zfa_hardware_read(fa, ZFA_CAR_SYS_PLL, &val);
if (!val) { if (!val) {
dev_err(hwdev, "System PLL not locked\n"); dev_err(msgdev, "System PLL not locked\n");
return -ENODEV; return -ENODEV;
} }
/* Verify that DDR3 calibration is done (1 is calibrated) */ /* Verify that DDR3 calibration is done (1 is calibrated) */
zfa_hardware_read(fa, ZFA_CAR_DDR_CAL, &val); zfa_hardware_read(fa, ZFA_CAR_DDR_CAL, &val);
if (!val) { if (!val) {
dev_err(hwdev, "DDR3 Calibration not done\n"); dev_err(msgdev, "DDR3 Calibration not done\n");
return -ENODEV; return -ENODEV;
} }
/* Allocate the hardware zio_device for registration */ /* Allocate the hardware zio_device for registration */
fa->hwzdev = zio_allocate_device(); fa->hwzdev = zio_allocate_device();
if (IS_ERR(fa->hwzdev)) { if (IS_ERR(fa->hwzdev)) {
dev_err(hwdev, "Cannot allocate ZIO device\n"); dev_err(msgdev, "Cannot allocate ZIO device\n");
err = PTR_ERR(fa->hwzdev); err = PTR_ERR(fa->hwzdev);
goto out_allocate; goto out_allocate;
} }
...@@ -1204,7 +1200,7 @@ int fa_zio_init(struct fa_dev *fa) ...@@ -1204,7 +1200,7 @@ int fa_zio_init(struct fa_dev *fa)
err = zio_register_device(fa->hwzdev, "adc-100m14b", err = zio_register_device(fa->hwzdev, "adc-100m14b",
fa->fmc->device_id); fa->fmc->device_id);
if (err) { if (err) {
dev_err(hwdev, "Cannot register ZIO device fmc-adc-100m14b\n"); dev_err(msgdev, "Cannot register ZIO device fmc-adc-100m14b\n");
goto out_dev; goto out_dev;
} }
return 0; return 0;
......
...@@ -109,12 +109,12 @@ static int zfat_conf_set(struct device *zdev, struct zio_attribute *zattr, ...@@ -109,12 +109,12 @@ static int zfat_conf_set(struct device *zdev, struct zio_attribute *zattr,
case ZFAT_SW: case ZFAT_SW:
/* Fire if software trigger is enabled (index 5) */ /* Fire if software trigger is enabled (index 5) */
if (!ti->zattr_set.ext_zattr[5].value) { if (!ti->zattr_set.ext_zattr[5].value) {
dev_err(dev, "sw trigger must be enable"); dev_info(dev, "sw trigger is not enabled\n");
return -EPERM; return -EPERM;
} }
/* Fire if nsamples!=0 */ /* Fire if nsamples!=0 */
if (!ti->nsamples) { if (!ti->nsamples) {
dev_err(dev, "there aren't samples to acquire"); dev_info(dev, "pre + post = 0: cannot acquire\n");
return -EINVAL; return -EINVAL;
} }
/* /*
...@@ -157,7 +157,8 @@ static struct zio_ti *zfat_create(struct zio_trigger_type *trig, ...@@ -157,7 +157,8 @@ static struct zio_ti *zfat_create(struct zio_trigger_type *trig,
struct zfat_instance *zfat; struct zfat_instance *zfat;
if (!fa) { if (!fa) {
dev_err(&cset->head.dev, "no spec device defined\n"); /* This only happens if we have a bug in the init sequence */
dev_err(&cset->head.dev, "No FMC device associated\n");
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
} }
...@@ -225,7 +226,7 @@ static void zfat_data_done(struct zio_cset *cset) ...@@ -225,7 +226,7 @@ static void zfat_data_done(struct zio_cset *cset)
struct fa_dev *fa = cset->zdev->priv_d; struct fa_dev *fa = cset->zdev->priv_d;
unsigned int i; unsigned int i;
dev_dbg(&cset->head.dev, "Data done\n"); dev_dbg(&fa->fmc->dev, "Data done\n");
/* Nothing to store */ /* Nothing to store */
if (!zfad_block) if (!zfad_block)
...@@ -234,11 +235,11 @@ static void zfat_data_done(struct zio_cset *cset) ...@@ -234,11 +235,11 @@ static void zfat_data_done(struct zio_cset *cset)
/* Store blocks */ /* Store blocks */
for(i = 0; i < fa->n_shots; ++i) for(i = 0; i < fa->n_shots; ++i)
if (likely(i < fa->n_fires)) {/* Store filled blocks */ if (likely(i < fa->n_fires)) {/* Store filled blocks */
dev_dbg(&cset->head.dev, "Store Block %i/%i\n", dev_dbg(&fa->fmc->dev, "Store Block %i/%i\n",
i + 1, fa->n_shots); i + 1, fa->n_shots);
bi->b_op->store_block(bi, zfad_block[i].block); bi->b_op->store_block(bi, zfad_block[i].block);
} else { /* Free un-filled blocks */ } else { /* Free un-filled blocks */
dev_dbg(&cset->head.dev, "Free un-acquired block %d/%d " dev_dbg(&fa->fmc->dev, "Free un-acquired block %d/%d "
"(received %d shots)\n", "(received %d shots)\n",
i + 1, fa->n_shots, fa->n_fires); i + 1, fa->n_shots, fa->n_fires);
bi->b_op->free_block(bi, zfad_block[i].block); bi->b_op->free_block(bi, zfad_block[i].block);
...@@ -264,22 +265,23 @@ static int zfat_arm_trigger(struct zio_ti *ti) ...@@ -264,22 +265,23 @@ static int zfat_arm_trigger(struct zio_ti *ti)
struct zio_channel *interleave = ti->cset->interleave; struct zio_channel *interleave = ti->cset->interleave;
struct zio_buffer_type *zbuf = ti->cset->zbuf; struct zio_buffer_type *zbuf = ti->cset->zbuf;
struct fa_dev *fa = ti->cset->zdev->priv_d; struct fa_dev *fa = ti->cset->zdev->priv_d;
struct device *msgdev = &fa->fmc->dev;
struct zio_block *block; struct zio_block *block;
struct zfad_block *zfad_block; struct zfad_block *zfad_block;
unsigned int size; unsigned int size;
uint32_t dev_mem_off; uint32_t dev_mem_off;
int i, err = 0; int i, err = 0;
dev_dbg(&ti->head.dev, "Arming trigger\n"); dev_dbg(msgdev, "Arming trigger\n");
/* Update the current control: sequence, nsamples and tstamp */ /* Update the current control: sequence, nsamples and tstamp */
interleave->current_ctrl->nsamples = ti->nsamples; interleave->current_ctrl->nsamples = ti->nsamples;
/* Allocate the necessary blocks for multi-shot acquisition */ /* Allocate the necessary blocks for multi-shot acquisition */
fa->n_shots = ti->zattr_set.std_zattr[ZIO_ATTR_TRIG_N_SHOTS].value; fa->n_shots = ti->zattr_set.std_zattr[ZIO_ATTR_TRIG_N_SHOTS].value;
dev_dbg(&ti->head.dev, "programmed shot %i\n", fa->n_shots); dev_dbg(msgdev, "programmed shot %i\n", fa->n_shots);
if (!fa->n_shots) { if (!fa->n_shots) {
dev_err(&ti->head.dev, "Cannot arm. No programmed shots\n"); dev_info(msgdev, "Cannot arm. No programmed shots\n");
return -EINVAL; return -EINVAL;
} }
...@@ -301,11 +303,11 @@ static int zfat_arm_trigger(struct zio_ti *ti) ...@@ -301,11 +303,11 @@ static int zfat_arm_trigger(struct zio_ti *ti)
dev_mem_off = 0; dev_mem_off = 0;
/* Allocate ZIO blocks */ /* Allocate ZIO blocks */
for (i = 0; i < fa->n_shots; ++i) { for (i = 0; i < fa->n_shots; ++i) {
dev_dbg(&ti->cset->head.dev, "Allocating block %d ...\n", i); dev_dbg(msgdev, "Allocating block %d ...\n", i);
block = zbuf->b_op->alloc_block(interleave->bi, size, block = zbuf->b_op->alloc_block(interleave->bi, size,
GFP_KERNEL); GFP_KERNEL);
if (!block) { if (!block) {
dev_err(&ti->cset->head.dev, dev_err(msgdev,
"arm trigger fail, cannot allocate block\n"); "arm trigger fail, cannot allocate block\n");
err = -ENOMEM; err = -ENOMEM;
goto out_allocate; goto out_allocate;
...@@ -317,7 +319,7 @@ static int zfat_arm_trigger(struct zio_ti *ti) ...@@ -317,7 +319,7 @@ static int zfat_arm_trigger(struct zio_ti *ti)
zfad_block[i].block = block; zfad_block[i].block = block;
zfad_block[i].dev_mem_off = dev_mem_off; zfad_block[i].dev_mem_off = dev_mem_off;
dev_mem_off += size; dev_mem_off += size;
dev_dbg(&ti->cset->head.dev, "next dev_mem_off 0x%x (+%d)", dev_dbg(msgdev, "next dev_mem_off 0x%x (+%d)",
dev_mem_off, size); dev_mem_off, size);
} }
...@@ -350,7 +352,7 @@ static void zfat_abort(struct zio_ti *ti) ...@@ -350,7 +352,7 @@ static void zfat_abort(struct zio_ti *ti)
struct zfad_block *zfad_block = cset->interleave->priv_d; struct zfad_block *zfad_block = cset->interleave->priv_d;
unsigned int i; unsigned int i;
dev_dbg(&ti->head.dev, "Aborting trigger"); dev_dbg(&fa->fmc->dev, "Aborting trigger");
/* Free all blocks */ /* Free all blocks */
for(i = 0; i < fa->n_shots; ++i) for(i = 0; i < fa->n_shots; ++i)
bi->b_op->free_block(bi, zfad_block[i].block); bi->b_op->free_block(bi, zfad_block[i].block);
...@@ -364,8 +366,6 @@ static int zfat_push(struct zio_ti *ti, struct zio_channel *chan, ...@@ -364,8 +366,6 @@ static int zfat_push(struct zio_ti *ti, struct zio_channel *chan,
{ {
dev_err(&ti->head.dev, "trigger \"%s\" does not support output", dev_err(&ti->head.dev, "trigger \"%s\" does not support output",
ti->head.name); ti->head.name);
BUG();
return -EIO; return -EIO;
} }
......
...@@ -355,7 +355,7 @@ static inline int zfa_hardware_write(struct fa_dev *fa, ...@@ -355,7 +355,7 @@ static inline int zfa_hardware_write(struct fa_dev *fa,
uint32_t cur, val; uint32_t cur, val;
if ((usr_val & (~zfad_regs[index].mask))) { if ((usr_val & (~zfad_regs[index].mask))) {
dev_err(fa->fmc->hwdev, "value 0x%x must fit mask 0x%x\n", dev_info(&fa->fmc->dev, "value 0x%x must fit mask 0x%x\n",
usr_val, zfad_regs[index].mask); usr_val, zfad_regs[index].mask);
return -EINVAL; return -EINVAL;
} }
......
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