Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
f2783f0e
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
f2783f0e
编写于
10月 28, 2013
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'regmap/topic/field' into regmap-next
上级
bee54e31
a0102375
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
119 addition
and
0 deletion
+119
-0
drivers/base/regmap/internal.h
drivers/base/regmap/internal.h
+3
-0
drivers/base/regmap/regmap.c
drivers/base/regmap/regmap.c
+103
-0
include/linux/regmap.h
include/linux/regmap.h
+13
-0
未找到文件。
drivers/base/regmap/internal.h
浏览文件 @
f2783f0e
...
...
@@ -180,6 +180,9 @@ struct regmap_field {
/* lsb */
unsigned
int
shift
;
unsigned
int
reg
;
unsigned
int
id_size
;
unsigned
int
id_offset
;
};
#ifdef CONFIG_DEBUG_FS
...
...
drivers/base/regmap/regmap.c
浏览文件 @
f2783f0e
...
...
@@ -813,6 +813,8 @@ static void regmap_field_init(struct regmap_field *rm_field,
rm_field
->
reg
=
reg_field
.
reg
;
rm_field
->
shift
=
reg_field
.
lsb
;
rm_field
->
mask
=
((
BIT
(
field_bits
)
-
1
)
<<
reg_field
.
lsb
);
rm_field
->
id_size
=
reg_field
.
id_size
;
rm_field
->
id_offset
=
reg_field
.
id_offset
;
}
/**
...
...
@@ -1425,6 +1427,74 @@ int regmap_field_write(struct regmap_field *field, unsigned int val)
}
EXPORT_SYMBOL_GPL
(
regmap_field_write
);
/**
* regmap_field_update_bits(): Perform a read/modify/write cycle
* on the register field
*
* @field: Register field to write to
* @mask: Bitmask to change
* @val: Value to be written
*
* A value of zero will be returned on success, a negative errno will
* be returned in error cases.
*/
int
regmap_field_update_bits
(
struct
regmap_field
*
field
,
unsigned
int
mask
,
unsigned
int
val
)
{
mask
=
(
mask
<<
field
->
shift
)
&
field
->
mask
;
return
regmap_update_bits
(
field
->
regmap
,
field
->
reg
,
mask
,
val
<<
field
->
shift
);
}
EXPORT_SYMBOL_GPL
(
regmap_field_update_bits
);
/**
* regmap_fields_write(): Write a value to a single register field with port ID
*
* @field: Register field to write to
* @id: port ID
* @val: Value to be written
*
* A value of zero will be returned on success, a negative errno will
* be returned in error cases.
*/
int
regmap_fields_write
(
struct
regmap_field
*
field
,
unsigned
int
id
,
unsigned
int
val
)
{
if
(
id
>=
field
->
id_size
)
return
-
EINVAL
;
return
regmap_update_bits
(
field
->
regmap
,
field
->
reg
+
(
field
->
id_offset
*
id
),
field
->
mask
,
val
<<
field
->
shift
);
}
EXPORT_SYMBOL_GPL
(
regmap_fields_write
);
/**
* regmap_fields_update_bits(): Perform a read/modify/write cycle
* on the register field
*
* @field: Register field to write to
* @id: port ID
* @mask: Bitmask to change
* @val: Value to be written
*
* A value of zero will be returned on success, a negative errno will
* be returned in error cases.
*/
int
regmap_fields_update_bits
(
struct
regmap_field
*
field
,
unsigned
int
id
,
unsigned
int
mask
,
unsigned
int
val
)
{
if
(
id
>=
field
->
id_size
)
return
-
EINVAL
;
mask
=
(
mask
<<
field
->
shift
)
&
field
->
mask
;
return
regmap_update_bits
(
field
->
regmap
,
field
->
reg
+
(
field
->
id_offset
*
id
),
mask
,
val
<<
field
->
shift
);
}
EXPORT_SYMBOL_GPL
(
regmap_fields_update_bits
);
/*
* regmap_bulk_write(): Write multiple registers to the device
*
...
...
@@ -1735,6 +1805,39 @@ int regmap_field_read(struct regmap_field *field, unsigned int *val)
}
EXPORT_SYMBOL_GPL
(
regmap_field_read
);
/**
* regmap_fields_read(): Read a value to a single register field with port ID
*
* @field: Register field to read from
* @id: port ID
* @val: Pointer to store read value
*
* A value of zero will be returned on success, a negative errno will
* be returned in error cases.
*/
int
regmap_fields_read
(
struct
regmap_field
*
field
,
unsigned
int
id
,
unsigned
int
*
val
)
{
int
ret
;
unsigned
int
reg_val
;
if
(
id
>=
field
->
id_size
)
return
-
EINVAL
;
ret
=
regmap_read
(
field
->
regmap
,
field
->
reg
+
(
field
->
id_offset
*
id
),
&
reg_val
);
if
(
ret
!=
0
)
return
ret
;
reg_val
&=
field
->
mask
;
reg_val
>>=
field
->
shift
;
*
val
=
reg_val
;
return
ret
;
}
EXPORT_SYMBOL_GPL
(
regmap_fields_read
);
/**
* regmap_bulk_read(): Read multiple registers from the device
*
...
...
include/linux/regmap.h
浏览文件 @
f2783f0e
...
...
@@ -431,11 +431,15 @@ bool regmap_reg_in_ranges(unsigned int reg,
* @reg: Offset of the register within the regmap bank
* @lsb: lsb of the register field.
* @reg: msb of the register field.
* @id_size: port size if it has some ports
* @id_offset: address offset for each ports
*/
struct
reg_field
{
unsigned
int
reg
;
unsigned
int
lsb
;
unsigned
int
msb
;
unsigned
int
id_size
;
unsigned
int
id_offset
;
};
#define REG_FIELD(_reg, _lsb, _msb) { \
...
...
@@ -454,6 +458,15 @@ void devm_regmap_field_free(struct device *dev, struct regmap_field *field);
int
regmap_field_read
(
struct
regmap_field
*
field
,
unsigned
int
*
val
);
int
regmap_field_write
(
struct
regmap_field
*
field
,
unsigned
int
val
);
int
regmap_field_update_bits
(
struct
regmap_field
*
field
,
unsigned
int
mask
,
unsigned
int
val
);
int
regmap_fields_write
(
struct
regmap_field
*
field
,
unsigned
int
id
,
unsigned
int
val
);
int
regmap_fields_read
(
struct
regmap_field
*
field
,
unsigned
int
id
,
unsigned
int
*
val
);
int
regmap_fields_update_bits
(
struct
regmap_field
*
field
,
unsigned
int
id
,
unsigned
int
mask
,
unsigned
int
val
);
/**
* Description of an IRQ for the generic regmap irq_chip.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录