Commit e40393eb authored by Federico Vaga's avatar Federico Vaga

sw:drv: memops are per-instance

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent f12ffd1e
......@@ -22,11 +22,6 @@ module_param_named(enable_test_data_adc, fa_enable_test_data_adc, int, 0444);
#define FA_EEPROM_TYPE "at24c64"
struct fa_memory_ops memops = {
.read = NULL,
.write = NULL,
};
static const int zfad_hw_range[] = {
[FA100M14B4C_RANGE_10V_CAL] = 0x44,
......@@ -561,13 +556,13 @@ int fa_probe(struct platform_device *pdev)
/* Assign IO operation */
switch (pdev->id_entry->driver_data) {
case ADC_VER_SPEC:
memops.read = ioread32;
memops.write = iowrite32;
fa->memops.read = ioread32;
fa->memops.write = iowrite32;
fa->sg_alloc_table_from_pages = __sg_alloc_table_from_pages;
break;
case ADC_VER_SVEC:
memops.read = ioread32be;
memops.write = iowrite32be;
fa->memops.read = ioread32be;
fa->memops.write = iowrite32be;
fa->sg_alloc_table_from_pages = sg_alloc_table_from_pages_no_squash;
break;
default:
......
......@@ -195,8 +195,6 @@ struct fa_memory_ops {
void (*write)(u32 value, void *addr);
};
extern struct fa_memory_ops memops;
/*
* ZFA_CHx_MULT : the trick which requires channel regs id grouped and ordered
* address offset between two registers of the same type on consecutive channel
......@@ -402,6 +400,7 @@ struct fa_dev {
struct zio_device *hwzdev;
struct fmc_slot *slot;
struct fa_memory_ops memops;
/* carrier common base offset addresses obtained from SDB */
void *fa_adc_csr_base;
......@@ -522,12 +521,12 @@ static inline struct fa_dev *get_zfadc(struct device *dev)
static inline u32 fa_ioread(struct fa_dev *fa, void *addr)
{
return memops.read(addr);
return fa->memops.read(addr);
}
static inline void fa_iowrite(struct fa_dev *fa, u32 value, void *addr)
{
memops.write(value, addr);
fa->memops.write(value, addr);
}
static inline uint32_t fa_readl(struct fa_dev *fa,
......
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