summaryrefstree
path: root/kernel/drivers/phy/phy-exynos-debug.h
blob: 0a5a70f8d015a190389eb5ae712d404afed5a63e (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/**
 * phy-exynos-debug.h -  Samsung EXYNOS SoC series USB DRD PHY Debug Header
 *
 * Phy provider for USB 3.0 DRD controller on Exynos SoC series
 *
 * Copyright (C) 2016 Samsung Electronics Co., Ltd.
 * Author: Kyounghye Yunm <k-hye.yun@samsung.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#include "phy-exynos-usbdrd.h"
#ifdef CONFIG_DEBUG_FS
extern int exynos_usbdrd_debugfs_init(struct exynos_usbdrd_phy *phy_drd);
extern int exynos_usbdrd_dp_debugfs_init(struct exynos_usbdrd_phy *phy_drd);
extern void exynos_usbdrd_debugfs_exit(struct exynos_usbdrd_phy *phy_drd);
#else
static inline int exynos_usbdrd_debugfs_init(struct exynos_usbdrd_phy *)
{  return 0;  }
static inline void exynos_usbdrd_debugfs_exit(struct exynos_usbdrd_phy *)
{  }
#endif

#define dump_register(nm)		\
{					\
	.name = __stringify(nm),	\
	.offset = EXYNOS_USBCON_##nm,	\
}
#define dump_regmap_mask(nm, bit_nm, bit)	\
{						\
	.name = __stringify(nm),		\
	.offset = EXYNOS_USBCON_##nm,		\
	.bitname = #bit_nm,			\
	.bitmask = nm##_##bit_nm##_MASK,	\
	.bitoffset = bit,			\
	.mask = true,				\
}
#define dump_regmap(nm, bit_nm, bit)	\
{					\
	.name = __stringify(nm),	\
	.offset = EXYNOS_USBCON_##nm,	\
	.bitname = #bit_nm,		\
	.bitmask = nm##_##bit_nm,	\
	.bitoffset = bit,		\
	.mask = false,			\
}

#define dump_register_dp(rnm)		\
{					\
	.name = __stringify(rnm),	\
	.offset = EXYNOS_USBDP_COM_##rnm,	\
}
#define dump_regmap_dp_mask(rnm, bit_rnm, bit_nm, bit)	\
{						\
	.name = __stringify(rnm),		\
	.offset = EXYNOS_USBDP_COM_##rnm,		\
	.bitname = #bit_nm,			\
	.bitmask = bit_rnm##_##bit_nm##_MASK,	\
	.bitoffset = bit,			\
	.mask = true,				\
}
#define dump_regmap_dp(rnm, bit_rnm, bit_nm, bit)	\
{					\
	.name = __stringify(rnm),	\
	.offset = EXYNOS_USBDP_COM_##rnm,	\
	.bitname = #bit_nm,		\
	.bitmask = bit_rnm##_##bit_nm,	\
	.bitoffset = bit,		\
	.mask = false,			\
}

struct debugfs_regmap32 {
	char *name;
	char *bitname;
	unsigned int offset;
	unsigned int bitoffset;
	unsigned int bitmask;
	bool mask;
};

struct debugfs_regset_map {
	const struct debugfs_regmap32 *regs;
	int nregs;
};

struct exynos_debugfs_prvdata {
	struct exynos_usbdrd_phy *phy_drd;
	struct dentry	*root;
	struct debugfs_regset32 *regset;
	struct debugfs_regset_map *regmap;
};