Commit 747068c1 authored by Federico Vaga's avatar Federico Vaga

sw:drv: style fixes from checkpatch.pl

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 14cca4e8
// SPDX-FileCopyrightText: 2020 CERN (home.cern)
//
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2020 CERN (home.cern)
/*
* EEPROM calibration block retreival code for fa-dev
......@@ -16,10 +15,10 @@
#include <linux/jiffies.h>
#include "fmc-adc-100m14b4cha-private.h"
static int fa_calib_temp_period = 0;
static int fa_calib_temp_period;
module_param_named(temp_calib_period, fa_calib_temp_period, int, 0444);
static int fa_calib_temp = 0;
static int fa_calib_temp;
module_param_named(temp_calib, fa_calib_temp, int, 0444);
/* This identity calibration is used as default */
......@@ -48,7 +47,7 @@ static int fa_calib_apply(struct fa_dev *fa)
return -EBUSY;
}
fa_writel(fa, fa->fa_adc_csr_base, &zfad_regs[ZFA_CTL_CALIB_APPLY], 1);
ndelay(100);
ndelay(100);
if (fa_calib_is_busy(fa)) {
dev_err(&fa->pdev->dev,
"%s Calibration value applied but still 'busy'\n",
......@@ -134,7 +133,7 @@ static const int64_t gain_dac_error_slope_fix[] = {
static int fa_calib_dac_gain_fix(int range, uint32_t gain_c,
int32_t delta_temp)
{
int64_t error;
int64_t error;
error = gain_dac_error_slope_fix[range] * delta_temp;
error /= 0x2000; /* see comment above for gain_dac_error_slope_fix */
......@@ -148,7 +147,7 @@ static bool fa_calib_is_compensation_on(struct fa_dev *fa)
if (unlikely((fa->flags & FA_DEV_F_PATTERN_DATA)))
return false;
if (unlikely(fa_calib_temp))
if (unlikely(fa_calib_temp))
return true;
return false;
......@@ -224,7 +223,7 @@ static int64_t fa_dac_offset_raw_calibrate(int32_t raw_offset,
int64_t hwval;
hwval = ((raw_offset + offset) * gain) >> 15; /* signed */
hwval += 0x8000; /* offset binary */
hwval += 0x8000; /* offset binary */
if (hwval < 0)
hwval = 0;
if (hwval > 0xffff)
......@@ -248,7 +247,7 @@ static int fa_dac_offset_get(struct fa_dev *fa, unsigned int chan)
off_uv = DAC_SAT_UP;
}
return off_uv;
return off_uv;
}
/**
......@@ -264,8 +263,8 @@ int fa_calib_dac_config_chan(struct fa_dev *fa, unsigned int chan,
{
int32_t off_uv = fa_dac_offset_get(fa, chan);
int32_t off_uv_raw = fa_dac_offset_raw_get(off_uv);
int range = fa->range[chan];
struct fa_calib_stanza *cal = &fa->calib.dac[range];
int range = fa->range[chan];
struct fa_calib_stanza *cal = &fa->calib.dac[range];
int gain;
int hwval;
......@@ -290,7 +289,7 @@ int fa_calib_dac_config_chan(struct fa_dev *fa, unsigned int chan,
hwval = fa_dac_offset_raw_calibrate(off_uv_raw, gain,
cal->offset[chan]);
return fa_dac_offset_set(fa, chan, hwval);
return fa_dac_offset_set(fa, chan, hwval);
}
void fa_calib_config_chan(struct fa_dev *fa, unsigned int chan,
......@@ -504,8 +503,9 @@ int fa_calib_init(struct fa_dev *fa)
fa_calib_write(fa, &calib);
/* First calibration.
The board has just been reset by the carrier before calling this
driver and reading the temperature read needs at least 350ms */
* The board has just been reset by the carrier before calling this
* driver and reading the temperature read needs at least 350ms
*/
msleep(400);
fa_calib_config(fa);
......
......@@ -20,7 +20,7 @@
static int fa_enable_test_data_fpga;
module_param_named(enable_test_data_fpga, fa_enable_test_data_fpga, int, 0444);
static int version_ignore = 0;
static int version_ignore;
module_param(version_ignore, int, 0644);
MODULE_PARM_DESC(version_ignore,
"Ignore the version declared in the FPGA and force the driver to load all components (default 0)");
......@@ -44,17 +44,18 @@ struct workqueue_struct *fa_workqueue;
static int fa_sg_alloc_table_from_pages(struct sg_table *sgt,
struct page **pages,
unsigned int n_pages,
unsigned int offset,
unsigned long size,
unsigned int max_segment,
gfp_t gfp_mask)
struct page **pages,
unsigned int n_pages,
unsigned int offset,
unsigned long size,
unsigned int max_segment,
gfp_t gfp_mask)
{
#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE
struct scatterlist *sg;
sg = __sg_alloc_table_from_pages(sgt, pages, n_pages, offset, size,
max_segment, NULL, 0, gfp_mask);
max_segment, NULL, 0, gfp_mask);
if (IS_ERR(sg))
return PTR_ERR(sg);
else
......@@ -75,7 +76,7 @@ int fa_adc_output_randomizer_set(struct fa_dev *fa, bool enable)
uint32_t tx, rx;
int err;
tx = 0x8000;
tx = 0x8000;
tx |= (1 << 8);
err = fa_spi_xfer(fa, FA_SPI_SS_ADC, 16, tx, &rx);
if (err)
......@@ -105,7 +106,7 @@ bool fa_adc_is_output_randomizer(struct fa_dev *fa)
uint32_t tx, rx;
int err;
tx = 0x8000;
tx = 0x8000;
tx |= (1 << 8);
err = fa_spi_xfer(fa, FA_SPI_SS_ADC, 16, tx, &rx);
if (err)
......@@ -156,13 +157,13 @@ int fa_trigger_software(struct fa_dev *fa)
return -EPERM;
}
/* Fire if nsamples!=0 */
/* Fire if nsamples!=0 */
if (!ti->nsamples) {
dev_info(&fa->pdev->dev, "pre + post = 0: cannot acquire\n");
return -EINVAL;
}
/*
/*
* We can do a software trigger if the FSM is not in
* the WAIT trigger status. Wait for it.
* Remember that: timeout is in us, a sample takes 10ns
......@@ -376,7 +377,7 @@ err:
* @enable 0 to disable, 1 to enable
*/
int fa_adc_data_pattern_get(struct fa_dev *fa, uint16_t *pattern,
unsigned int *enable)
unsigned int *enable)
{
uint32_t tx, rx;
int err;
......@@ -472,8 +473,7 @@ int zfad_fsm_command(struct fa_dev *fa, uint32_t command)
if (command == FA100M14B4C_CMD_START) {
if (!fa_adc_is_serdes_ready(fa)) {
dev_err(fa->msgdev,
"Cannot start acquisition: "
"SerDes PLL not locked or synchronized (0x%08x)\n",
"Cannot start acquisition: SerDes PLL not locked or synchronized (0x%08x)\n",
fa_ioread(fa, fa->fa_adc_csr_base + ADC_CSR_STA_REG_OFFSET));
return -EBUSY;
}
......@@ -488,8 +488,8 @@ int zfad_fsm_command(struct fa_dev *fa, uint32_t command)
* from zfat_arm_trigger() or zfad_input_cset()
*/
if (!(cset->ti->flags & ZIO_TI_ARMED)) {
dev_info(fa->msgdev, "Cannot start acquisition: "
"Trigger refuses to arm\n");
dev_info(fa->msgdev,
"Cannot start acquisition: Trigger refuses to arm\n");
return -EIO;
}
......@@ -587,8 +587,8 @@ static int __fa_init(struct fa_dev *fa)
/* This structure lists the various subsystems */
struct fa_modlist {
char *name;
int (*init)(struct fa_dev *);
void (*exit)(struct fa_dev *);
int (*init)(struct fa_dev *fa);
void (*exit)(struct fa_dev *fa);
};
static struct fa_modlist mods[] = {
......@@ -685,7 +685,7 @@ static void fa_sg_alloc_table_init(struct fa_dev *fa)
static struct fmc_adc_platform_data fmc_adc_pdata_default = {
.flags = 0,
.vme_reg_offset = 0,
.vme_dma_offset = 0,
.vme_dma_offset = 0,
.calib_trig_time = 0,
.calib_trig_threshold = 0,
.calib_trig_internal = 0,
......@@ -737,14 +737,14 @@ static bool fa_is_fpga_valid(struct fa_dev *fa)
}
switch (fa->meta.device) {
case FA_META_DEVICE_ID_SVEC_DBL_ADC:
break;
case FA_META_DEVICE_ID_SPEC:
break;
default:
dev_err(&fa->pdev->dev,
"Unknow device ID: %08x\n", fa->meta.device);
return false;
case FA_META_DEVICE_ID_SVEC_DBL_ADC:
break;
case FA_META_DEVICE_ID_SPEC:
break;
default:
dev_err(&fa->pdev->dev, "Unknow device ID: %08x\n",
fa->meta.device);
return false;
}
if (!fa_is_fpga_version_valid(FA_VERSION_DRV, fa->meta.version)) {
......@@ -819,7 +819,7 @@ int fa_probe(struct platform_device *pdev)
}
}
if(!fa_fmc_slot_is_valid(fa))
if (!fa_fmc_slot_is_valid(fa))
goto out_fmc_err;
err = sysfs_create_link(&fa->pdev->dev.kobj, &fa->slot->dev.kobj,
......@@ -907,6 +907,7 @@ int fa_remove(struct platform_device *pdev)
while (--i >= 0) {
struct fa_modlist *m = mods + i;
if (m->exit)
m->exit(fa);
}
......@@ -944,14 +945,14 @@ static int fa_init(void)
{
int ret;
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)
#if KERNEL_VERSION(3, 15, 0) > LINUX_VERSION_CODE
fa_workqueue = alloc_workqueue(fa_dev_drv.driver.name,
WQ_NON_REENTRANT | WQ_UNBOUND |
WQ_MEM_RECLAIM, 1);
#else
#else
fa_workqueue = alloc_workqueue(fa_dev_drv.driver.name,
WQ_UNBOUND | WQ_MEM_RECLAIM, 1);
#endif
#endif
if (fa_workqueue == NULL)
return -ENOMEM;
......
......@@ -9,22 +9,22 @@
#include "fmc-adc-100m14b4cha-private.h"
#define FA_DBG_REG32_CH(_n) \
{.name = "ADC-CSR:ch"#_n"_ctl", .offset = ADC_CSR_OFF + 0x080 + ((_n - 1) * 0x40)}, \
{.name = "ADC-CSR:ch"#_n"_sta", .offset = ADC_CSR_OFF + 0x084 + ((_n - 1) * 0x40)}, \
{.name = "ADC-CSR:ch"#_n"_cal_nb", .offset = ADC_CSR_OFF + 0x088 + ((_n - 1) * 0x40)}, \
{.name = "ADC-CSR:ch"#_n"_sat", .offset = ADC_CSR_OFF + 0x08C + ((_n - 1) * 0x40)}, \
{.name = "ADC-CSR:ch"#_n"_trig_thres", .offset = ADC_CSR_OFF + 0x090 + ((_n - 1) * 0x40)}, \
{.name = "ADC-CSR:ch"#_n"_ctl", .offset = ADC_CSR_OFF + 0x080 + ((_n - 1) * 0x40)}, \
{.name = "ADC-CSR:ch"#_n"_sta", .offset = ADC_CSR_OFF + 0x084 + ((_n - 1) * 0x40)}, \
{.name = "ADC-CSR:ch"#_n"_cal_nb", .offset = ADC_CSR_OFF + 0x088 + ((_n - 1) * 0x40)}, \
{.name = "ADC-CSR:ch"#_n"_sat", .offset = ADC_CSR_OFF + 0x08C + ((_n - 1) * 0x40)}, \
{.name = "ADC-CSR:ch"#_n"_trig_thres", .offset = ADC_CSR_OFF + 0x090 + ((_n - 1) * 0x40)}, \
{.name = "ADC-CSR:ch"#_n"_trig_dly", .offset = ADC_CSR_OFF + 0x094 + ((_n - 1) * 0x40)}
#define FA_DBG_REG32_TIM(_name, _off) \
{ \
.name = "TIME-TAG:"#_name"_seconds_upper", \
#define FA_DBG_REG32_TIM(_name, _off) \
{ \
.name = "TIME-TAG:"#_name"_seconds_upper", \
.offset = ADC_UTC_OFF + _off \
}, { \
.name = "TIME-TAG:"#_name"_seconds_lower", \
}, { \
.name = "TIME-TAG:"#_name"_seconds_lower", \
.offset = ADC_UTC_OFF + _off + 0x4, \
}, { \
.name = "TIME-TAG:"#_name"_coarse", \
}, { \
.name = "TIME-TAG:"#_name"_coarse", \
.offset = ADC_UTC_OFF + _off + 0x8, \
}
......@@ -139,8 +139,8 @@ static void fa_regdump_seq_read_spi(struct fa_dev *fa, struct seq_file *s)
{
int i;
seq_printf(s, "ADC SPI registers\n");
seq_printf(s, "Address Data\n");
seq_puts(s, "ADC SPI registers\n");
seq_puts(s, "Address Data\n");
for (i = 0; i < 5; ++i) {
uint32_t tx, rx;
int err;
......@@ -149,11 +149,9 @@ static void fa_regdump_seq_read_spi(struct fa_dev *fa, struct seq_file *s)
err = fa_spi_xfer(fa, FA_SPI_SS_ADC, 16, tx, &rx);
rx &= 0xFF; /* the value is 8bit */
if (err)
seq_printf(s, "A%d %02xh read failure!\n",
i, i);
seq_printf(s, "A%d %02xh read failure!\n", i, i);
else
seq_printf(s, "A%d %02xh 0x%02x\n",
i, i, rx);
seq_printf(s, "A%d %02xh 0x%02x\n", i, i, rx);
}
}
......@@ -183,7 +181,7 @@ static const struct file_operations fa_regdump_ops = {
static ssize_t fa_trg_sw_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
size_t count, loff_t *ppos)
{
struct fa_dev *fa = file->private_data;
int err;
......@@ -212,7 +210,7 @@ static int fa_data_pattern_adc_write(struct fa_dev *fa, const char __user *buf,
if (err)
return -EFAULT;
if ((count == 1 || count == 2)&& buf_l[0] == '0') {
if ((count == 1 || count == 2) && buf_l[0] == '0') {
err = fa_adc_data_pattern_set(fa, 0, 0);
fa_calib_init(fa);
return err;
......@@ -249,10 +247,10 @@ static ssize_t fa_data_pattern_write(struct file *file, const char __user *buf,
err = fa_data_pattern_adc_write(fa, buf + 4, count - 4);
return err ? err : count;
} else {
dev_err(&fa->pdev->dev, "Unknown command \"%s\"\n", buf_l);
return -EINVAL;
}
dev_err(&fa->pdev->dev, "Unknown command \"%s\"\n", buf_l);
return -EINVAL;
}
static ssize_t fa_data_pattern_read(struct file *file, char __user *buf,
......@@ -264,10 +262,10 @@ static ssize_t fa_data_pattern_read(struct file *file, char __user *buf,
unsigned int enable;
int err;
if (*ppos > 0)
if (*ppos > 0)
return 0;
err = fa_adc_data_pattern_get(fa, &pattern, &enable);
err = fa_adc_data_pattern_get(fa, &pattern, &enable);
if (err)
return err;
snprintf(buf_l, FA_ADC_DATA_PATTERN_CMD_SIZE, "adc %u 0x%02x\n",
......
......@@ -7,6 +7,7 @@
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/types.h>
#ifdef CONFIG_FMC_ADC_SVEC
#include "vmebus.h"
#endif
......@@ -36,7 +37,9 @@ static void fix_endianness(unsigned int byte_length, void *buffer)
le32_to_cpus(ptr);
}
#else
static void fix_endianness(unsigned int byte_length, void *buffer){ return; }
static void fix_endianness(unsigned int byte_length, void *buffer)
{
}
#endif
struct zfad_timetag {
......@@ -63,7 +66,7 @@ static bool fa_dmaengine_filter_svec(struct dma_chan *dchan, void *arg)
struct fa_dev *fa = arg;
struct device *device_ref;
device_ref = fa->pdev->dev.parent->parent->parent->parent->parent->parent;
device_ref = fa->pdev->dev.parent->parent->parent->parent->parent->parent;
return (dchan->device->dev == device_ref);
}
......@@ -74,7 +77,7 @@ int fa_dma_request_channel(struct fa_dev *fa)
struct resource *r;
int dma_dev_id;
if (fa_is_flag_set(fa, FMC_ADC_SVEC))
if (fa_is_flag_set(fa, FMC_ADC_SVEC))
return 0;
r = platform_get_resource(fa->pdev, IORESOURCE_DMA, ADC_DMA);
......@@ -176,7 +179,7 @@ static uint32_t fa_ddr_offset_multi(struct fa_dev *fa, uint32_t shot_n)
struct zio_cset *cset = fa->zdev->cset;
uint32_t off;
off = cset->interleave->current_ctrl->ssize * cset->ti->nsamples;
off = cset->interleave->current_ctrl->ssize * cset->ti->nsamples;
off += FA_TRIG_TIMETAG_BYTES;
off *= shot_n;
......@@ -187,11 +190,10 @@ static uint32_t fa_ddr_offset(struct fa_dev *fa, uint32_t shot_n)
{
WARN(fa->n_shots == 1 && shot_n != 0,
"Inconsistent shot number %d\n", shot_n);
if (fa->n_shots == 1) {
if (fa->n_shots == 1)
return fa_ddr_offset_single(fa);
} else {
else
return fa_ddr_offset_multi(fa, shot_n);
}
}
static unsigned int zfad_block_n_pages(struct zio_block *block)
......@@ -681,8 +683,7 @@ static int zfad_dma_start(struct zio_cset *cset)
err = fa_fsm_wait_state(fa, FA100M14B4C_STATE_IDLE, 10);
if (err) {
dev_warn(&fa->pdev->dev,
"Can't start DMA on the last acquisition, "
"State Machine is not IDLE\n");
"Can't start DMA on the last acquisition, State Machine is not IDLE\n");
return err;
}
......@@ -702,7 +703,7 @@ static int zfad_dma_start(struct zio_cset *cset)
if (err)
goto err_start;
return 0;
return 0;
err_start:
fa_writel(fa, fa->fa_adc_csr_base, &zfad_regs[ZFAT_CFG_SRC],
......@@ -757,7 +758,7 @@ static void zfad_block_ctrl_attr_update(struct zio_block *block,
struct zio_control *ctrl = zio_get_ctrl(block);
uint32_t *ext_val = ctrl->attr_channel.ext_val;
ext_val[FA100M14B4C_TATTR_STA]= timetag->status;
ext_val[FA100M14B4C_TATTR_STA] = timetag->status;
ctrl->seq_num = seq_num;
}
......
......@@ -104,7 +104,7 @@ static struct zio_attribute zfad_cset_ext_zattr[] = {
* 4: POST_TRIG
* 5: DECR_SHOT
* 7: Illegal
* */
*/
ZIO_PARAM_EXT("fsm-state", ZIO_RO_PERM, ZFA_STA_FSM, 0),
/* last acquisition end time stamp */
ZIO_PARAM_EXT("tstamp-acq-end-su", ZIO_RO_PERM,
......@@ -244,9 +244,8 @@ static int zfad_conf_set(struct device *dev, struct zio_attribute *zattr,
/*fallthrough*/
case ZFA_CH4_OFFSET:
i--;
chan = to_zio_cset(dev)->chan + i;
if (!fa_is_dac_offset_valid(usr_val,
fa->zero_offset[chan->index]))
chan = to_zio_cset(dev)->chan + i;
if (!fa_is_dac_offset_valid(usr_val, fa->zero_offset[chan->index]))
return -EINVAL;
spin_lock(&fa->zdev->cset->lock);
fa->user_offset[chan->index] = usr_val;
......@@ -425,18 +424,16 @@ static inline int zfat_overflow_detection(struct zio_ti *ti)
nsamples = ti_zattr[ZIO_ATTR_TRIG_PRE_SAMP].value +
ti_zattr[ZIO_ATTR_TRIG_POST_SAMP].value;
shot_size = ((nsamples + 2) * ti->cset->ssize) * FA100M14B4C_NCHAN;
if ( (shot_size * nshot_t) > FA100M14B4C_MAX_ACQ_BYTE ) {
if ((shot_size * nshot_t) > FA100M14B4C_MAX_ACQ_BYTE) {
dev_err(fa->msgdev, "Cannot acquire, dev memory overflow\n");
return -ENOMEM;
}
/* in case of multi shot, each shot cannot exceed the dpram size */
if ( (nshot_t > 1) &&
(nsamples > fa->mshot_max_samples) ) {
dev_err(fa->msgdev, "Cannot acquire such amount of samples "
"(req: %d , max: %d) in multi shot mode."
"dev memory overflow\n",
nsamples, fa->mshot_max_samples);
if ((nshot_t > 1) && (nsamples > fa->mshot_max_samples)) {
dev_err(fa->msgdev,
"Cannot acquire such amount of samples (req: %d , max: %d) in multi shot mode. dev memory overflow\n",
nsamples, fa->mshot_max_samples);
return -ENOMEM;
}
return 0;
......@@ -634,9 +631,8 @@ static struct zio_driver fa_zdrv = {
.remove = zfad_zio_remove,
/* Take the version from ZIO git sub-module */
.min_version = ZIO_VERSION(__ZIO_MIN_MAJOR_VERSION,
__ZIO_MIN_MINOR_VERSION,
0), /* Change it if you use new features from
a specific patch */
__ZIO_MIN_MINOR_VERSION,
0),
};
......
......@@ -297,8 +297,7 @@ static int zfat_data_done(struct zio_cset *cset)
i + 1, fa->n_shots);
zio_buffer_store_block(bi, zfad_block[i].block);
} else { /* Free un-filled blocks */
dev_dbg(fa->msgdev, "Free un-acquired block %d/%d "
"(received %d shots)\n",
dev_dbg(fa->msgdev, "Free un-acquired block %d/%d (received %d shots)\n",
i + 1, fa->n_shots, fa->n_fires);
zio_buffer_free_block(bi, zfad_block[i].block);
}
......@@ -383,8 +382,7 @@ static int zfat_arm_trigger(struct zio_ti *ti)
if (size % 4) {
/* should never happen: increase the size accordling */
dev_warn(fa->msgdev,
"zio data block size should 32bit word aligned."
"original size:%d was increased by %d bytes\n",
"zio data block size should 32bit word aligned. original size:%d was increased by %d bytes\n",
size, size%4);
size += size % 4;
}
......@@ -496,8 +494,8 @@ int fa_trig_init(void)
err = zio_register_trig(&zfat_type, "adc-100m14b");
if (err)
pr_err("%s: Cannot register ZIO trigger type"
" \"adc-100m14b\" (error %i)\n", KBUILD_MODNAME, err);
pr_err("%s: Cannot register ZIO trigger type \"adc-100m14b\" (error %i)\n",
KBUILD_MODNAME, err);
return err;
}
......
......@@ -25,7 +25,8 @@ static const struct fmc_adc_platform_data fmc_adc_pdata = {
.calib_trig_internal = 0,
};
static int fa_spec_probe(struct platform_device *pdev) {
static int fa_spec_probe(struct platform_device *pdev)
{
static struct resource fa_spec_fdt_res[] = {
{
.name = "fmc-adc-mem",
......@@ -112,7 +113,8 @@ static int fa_spec_probe(struct platform_device *pdev) {
return 0;
}
static int fa_spec_remove(struct platform_device *pdev) {
static int fa_spec_remove(struct platform_device *pdev)
{
struct platform_device *pdev_child = platform_get_drvdata(pdev);
platform_device_unregister(pdev_child);
......@@ -144,11 +146,10 @@ static const struct platform_device_id fa_spec_id_table[] = {
};
static struct platform_driver fa_spec_driver = {
.driver =
{
.driver = {
.name = "fmc-adc-100m-spec",
.owner = THIS_MODULE,
},
},
.id_table = fa_spec_id_table,
.probe = fa_spec_probe,
.remove = fa_spec_remove,
......
......@@ -12,6 +12,7 @@
#include <linux/mfd/core.h>
#include <linux/fmc.h>
#include "fmc-adc-100m14b4cha-private.h"
#include "platform_data/fmc-adc-100m14b4cha.h"
#define SVEC_FMC_SLOTS 2
......@@ -30,10 +31,10 @@
enum fa_svec_dev_offsets {
FA_SVEC_DBL_ADC_META_START = 0x00000000,
FA_SVEC_DBL_ADC_META_END = 0x00000040,
FA_SVEC_ADC1_MEM_START = 0x00002000,
FA_SVEC_ADC1_MEM_END = 0x00003FFF,
FA_SVEC_ADC2_MEM_START = 0x00004000,
FA_SVEC_ADC2_MEM_END = 0x00005FFF,
FA_SVEC_ADC1_MEM_START = 0x00002000,
FA_SVEC_ADC1_MEM_END = 0x00003FFF,
FA_SVEC_ADC2_MEM_START = 0x00004000,
FA_SVEC_ADC2_MEM_END = 0x00005FFF,
};
static inline struct platform_device *platform_device_register_resndata_mask(
......@@ -59,19 +60,19 @@ static inline struct platform_device *platform_device_register_resndata_mask(
static struct fmc_adc_platform_data fa_svec_adc_pdata[] = {
{
.flags = FMC_ADC_BIG_ENDIAN |
FMC_ADC_SVEC |
FMC_ADC_NOSQUASH_SCATTERLIST,
FMC_ADC_SVEC |
FMC_ADC_NOSQUASH_SCATTERLIST,
.vme_reg_offset = SVEC_FPGA_CSR_DDR4_ADDR,
.vme_dma_offset = SVEC_FPGA_DDR4_DMA,
.vme_dma_offset = SVEC_FPGA_DDR4_DMA,
.calib_trig_time = 0,
.calib_trig_threshold = 0,
.calib_trig_internal = 0,
}, {
.flags = FMC_ADC_BIG_ENDIAN |
FMC_ADC_SVEC |
FMC_ADC_NOSQUASH_SCATTERLIST,
FMC_ADC_SVEC |
FMC_ADC_NOSQUASH_SCATTERLIST,
.vme_reg_offset = SVEC_FPGA_CSR_DDR5_ADDR,
.vme_dma_offset = SVEC_FPGA_DDR5_DMA,
.vme_dma_offset = SVEC_FPGA_DDR5_DMA,
.calib_trig_time = 0,
.calib_trig_threshold = 0,
.calib_trig_internal = 0,
......@@ -145,7 +146,7 @@ static int fa_svec_probe(struct platform_device *pdev)
int irq;
int i;
rmem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
rmem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!rmem) {
dev_err(&pdev->dev, "Missing memory resource\n");
return -EINVAL;
......@@ -167,7 +168,7 @@ static int fa_svec_probe(struct platform_device *pdev)
struct fmc_slot *slot = fmc_slot_get(pdev->dev.parent, i + 1);
int present;
if (IS_ERR(slot)) {
if (IS_ERR(slot)) {
dev_err(&pdev->dev,
"Can't find FMC slot %d err: %ld\n",
i + 1, PTR_ERR(slot));
......@@ -183,7 +184,7 @@ static int fa_svec_probe(struct platform_device *pdev)
memcpy(res, fa_svec_res[i], sizeof(res));
res[0].parent = rmem;
res[0].parent = rmem;
res[0].start += rmem->start;
res[0].end += rmem->start;
res[2].start += irq;
......@@ -207,7 +208,7 @@ static int fa_svec_probe(struct platform_device *pdev)
}
platform_set_drvdata(pdev, pdev_data);
return 0;
return 0;
}
static int fa_svec_remove(struct platform_device *pdev)
......@@ -218,12 +219,12 @@ static int fa_svec_remove(struct platform_device *pdev)
if (!pdev_data)
return 0;
for (i = 0; i < SVEC_FMC_SLOTS; ++i)
for (i = 0; i < SVEC_FMC_SLOTS; ++i)
if (pdev_data->adc[i])
platform_device_unregister(pdev_data->adc[i]);
kfree(pdev_data);
return 0;
return 0;
}
/**
......
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