Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
f1c6a7e0
Commit
f1c6a7e0
authored
Jul 04, 2024
by
Lee Jones
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ib-mfd-soc-samsung-6.11' into ibs-for-mfd-merged
parents
2a2ca717
35d6b98c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
24 deletions
+70
-24
drivers/mfd/syscon.c
drivers/mfd/syscon.c
+48
-0
drivers/soc/samsung/exynos-pmu.c
drivers/soc/samsung/exynos-pmu.c
+14
-24
include/linux/mfd/syscon.h
include/linux/mfd/syscon.h
+8
-0
No files found.
drivers/mfd/syscon.c
View file @
f1c6a7e0
...
...
@@ -192,6 +192,54 @@ static struct regmap *device_node_get_regmap(struct device_node *np,
return
syscon
->
regmap
;
}
/**
* of_syscon_register_regmap() - Register regmap for specified device node
* @np: Device tree node
* @regmap: Pointer to regmap object
*
* Register an externally created regmap object with syscon for the specified
* device tree node. This regmap will then be returned to client drivers using
* the syscon_regmap_lookup_by_phandle() API.
*
* Return: 0 on success, negative error code on failure.
*/
int
of_syscon_register_regmap
(
struct
device_node
*
np
,
struct
regmap
*
regmap
)
{
struct
syscon
*
entry
,
*
syscon
=
NULL
;
int
ret
;
if
(
!
np
||
!
regmap
)
return
-
EINVAL
;
syscon
=
kzalloc
(
sizeof
(
*
syscon
),
GFP_KERNEL
);
if
(
!
syscon
)
return
-
ENOMEM
;
/* check if syscon entry already exists */
spin_lock
(
&
syscon_list_slock
);
list_for_each_entry
(
entry
,
&
syscon_list
,
list
)
if
(
entry
->
np
==
np
)
{
ret
=
-
EEXIST
;
goto
err_unlock
;
}
syscon
->
regmap
=
regmap
;
syscon
->
np
=
np
;
/* register the regmap in syscon list */
list_add_tail
(
&
syscon
->
list
,
&
syscon_list
);
spin_unlock
(
&
syscon_list_slock
);
return
0
;
err_unlock:
spin_unlock
(
&
syscon_list_slock
);
kfree
(
syscon
);
return
ret
;
}
EXPORT_SYMBOL_GPL
(
of_syscon_register_regmap
);
struct
regmap
*
device_node_to_regmap
(
struct
device_node
*
np
)
{
return
device_node_get_regmap
(
np
,
false
);
...
...
drivers/soc/samsung/exynos-pmu.c
View file @
f1c6a7e0
...
...
@@ -204,16 +204,6 @@ static const struct regmap_config regmap_smccfg = {
.
reg_update_bits
=
tensor_sec_update_bits
,
};
static
const
struct
regmap_config
regmap_mmiocfg
=
{
.
name
=
"pmu_regs"
,
.
reg_bits
=
32
,
.
reg_stride
=
4
,
.
val_bits
=
32
,
.
fast_io
=
true
,
.
use_single_read
=
true
,
.
use_single_write
=
true
,
};
static
const
struct
exynos_pmu_data
gs101_pmu_data
=
{
.
pmu_secure
=
true
};
...
...
@@ -290,7 +280,6 @@ EXPORT_SYMBOL_GPL(exynos_get_pmu_regmap);
struct
regmap
*
exynos_get_pmu_regmap_by_phandle
(
struct
device_node
*
np
,
const
char
*
propname
)
{
struct
exynos_pmu_context
*
ctx
;
struct
device_node
*
pmu_np
;
struct
device
*
dev
;
...
...
@@ -316,9 +305,7 @@ struct regmap *exynos_get_pmu_regmap_by_phandle(struct device_node *np,
if
(
!
dev
)
return
ERR_PTR
(
-
EPROBE_DEFER
);
ctx
=
dev_get_drvdata
(
dev
);
return
ctx
->
pmureg
;
return
syscon_node_to_regmap
(
pmu_np
);
}
EXPORT_SYMBOL_GPL
(
exynos_get_pmu_regmap_by_phandle
);
...
...
@@ -355,19 +342,22 @@ static int exynos_pmu_probe(struct platform_device *pdev)
regmap
=
devm_regmap_init
(
dev
,
NULL
,
(
void
*
)(
uintptr_t
)
res
->
start
,
&
pmu_regmcfg
);
if
(
IS_ERR
(
regmap
))
return
dev_err_probe
(
&
pdev
->
dev
,
PTR_ERR
(
regmap
),
"regmap init failed
\n
"
);
ret
=
of_syscon_register_regmap
(
dev
->
of_node
,
regmap
);
if
(
ret
)
return
ret
;
}
else
{
/* All other SoCs use a MMIO regmap */
pmu_regmcfg
=
regmap_mmiocfg
;
pmu_regmcfg
.
max_register
=
resource_size
(
res
)
-
pmu_regmcfg
.
reg_stride
;
regmap
=
devm_regmap_init_mmio
(
dev
,
pmu_base_addr
,
&
pmu_regmcfg
);
/* let syscon create mmio regmap */
regmap
=
syscon_node_to_regmap
(
dev
->
of_node
);
if
(
IS_ERR
(
regmap
))
return
dev_err_probe
(
&
pdev
->
dev
,
PTR_ERR
(
regmap
),
"syscon_node_to_regmap failed
\n
"
);
}
if
(
IS_ERR
(
regmap
))
return
dev_err_probe
(
&
pdev
->
dev
,
PTR_ERR
(
regmap
),
"regmap init failed
\n
"
);
pmu_context
->
pmureg
=
regmap
;
pmu_context
->
dev
=
dev
;
...
...
include/linux/mfd/syscon.h
View file @
f1c6a7e0
...
...
@@ -28,6 +28,8 @@ struct regmap *syscon_regmap_lookup_by_phandle_args(struct device_node *np,
unsigned
int
*
out_args
);
struct
regmap
*
syscon_regmap_lookup_by_phandle_optional
(
struct
device_node
*
np
,
const
char
*
property
);
int
of_syscon_register_regmap
(
struct
device_node
*
np
,
struct
regmap
*
regmap
);
#else
static
inline
struct
regmap
*
device_node_to_regmap
(
struct
device_node
*
np
)
{
...
...
@@ -67,6 +69,12 @@ static inline struct regmap *syscon_regmap_lookup_by_phandle_optional(
return
NULL
;
}
static
inline
int
of_syscon_register_regmap
(
struct
device_node
*
np
,
struct
regmap
*
regmap
)
{
return
-
EOPNOTSUPP
;
}
#endif
#endif
/* __LINUX_MFD_SYSCON_H__ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment