-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathafhba_core.c
More file actions
55 lines (48 loc) · 2.32 KB
/
afhba_core.c
File metadata and controls
55 lines (48 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* ------------------------------------------------------------------------- */
/* afhba_core.c AFHBA */
/*
* afhba_core.c
*
* Created on: 24 Jan 2015
* Author: pgm
*/
/* ------------------------------------------------------------------------- */
/* Copyright (C) 2015 Peter Milne, D-TACQ Solutions Ltd *
* <peter dot milne at D hyphen TACQ dot com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of Version 2 of the GNU General Public License *
* as published by the Free Software Foundation; *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* ------------------------------------------------------------------------- */
#include "acq-fiber-hba.h"
/* this fragment of code is linked into >1 module
* debugs individually switched from module params
* do not use dev_dbg - multiple instances same file..
*/
int reg_access_verbose;
module_param(reg_access_verbose, int, 0644);
#define VBS1 (reg_access_verbose >= 1)
#define VBS2 (reg_access_verbose >= 2)
void afhba_write_reg(struct AFHBA_DEV *adev, int regoff, u32 value)
{
void* va = adev->mappings[REGS_BAR].va + regoff;
if (VBS1) dev_info(pdev(adev), "afhba_write_reg %04x = %08x", regoff, value);
writel(value, va);
if (VBS2) dev_info(pdev(adev), "%p : %08x", va, readl(va));
}
u32 afhba_read_reg(struct AFHBA_DEV *adev, int regoff)
{
void* va = adev->mappings[REGS_BAR].va + regoff;
u32 rv = readl(va);
if (VBS1) dev_info(pdev(adev), "afhba_read_reg %04x = %08x", regoff, rv);
return rv;
}